Skip to content

Switch to the LLVM SPIR-V back-end. #491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Feb 13, 2025

PoC, requires quite some work

  • exp intrinsic is broken
    PHI node operands are not the same type as the result!
      %common.ret.op = phi [2 x float] [ %177, %L5 ], [ %192, %L28 ], [ %201, %L41 ], [ %213, %L53 ], [ %4, %L25 ], [ %8, %L19 ]
    Function return type does not match operand type of return inst!
      ret [2 x float] %common.ret.op
     i32in function julia_exp_27849
    
  • atomics probably have to be ported to native LLVM atomics
  • the lack of OpCapability Linkage results in ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED (I think)

@maleadt
Copy link
Member Author

maleadt commented Feb 13, 2025

the lack of OpCapability Linkage results in ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED (I think)

The actual issue is our use of OpenCL intrinsic functions to access things like the work dimension. We'll have to implement get_work_dim as an access to @__spirv_BuiltInWorkDim = external addrspace(1) global i32 instead of call to _Z12get_work_dim.

@maleadt
Copy link
Member Author

maleadt commented Jul 10, 2025

Rebased. Things work, however, this triggers multiple crashes in the Intel compiler stack. Anybody who would want to look into this would need to (first upgrade the compiler stack, but if things persist then) reduce the issues to minimal issues and file them upstream.

@michel2323 michel2323 force-pushed the tb/llvm_spirv_backend branch from 5c96f50 to e506217 Compare August 22, 2025 15:54
@michel2323
Copy link
Contributor

@maleadt We released a new oneAPI.jl version with NEO 25 and then rebased this branch. Now I get error: undefined reference to '_Z17__spirv_IAddCarryll'. Since this looks like a missing intrinsic I tried to bump SPIRVInstrinsics. However, in later versions this requires a method_table in oneAPI. I've tried to add that too, but I can't get the kernels to pick up anything and they return zeros. Mainly, I was then fiddling with @device_override, but I just got lost. Can you help a long here a bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants