Skip to content

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

Merged
maleadt merged 1 commit into
mainfrom
tb/llvm_spirv_backend
Jun 17, 2026
Merged

Switch to the LLVM SPIR-V back-end.#491
maleadt merged 1 commit into
mainfrom
tb/llvm_spirv_backend

Conversation

@maleadt

@maleadt maleadt commented Feb 13, 2025

Copy link
Copy Markdown
Member

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

maleadt commented Feb 13, 2025

Copy link
Copy Markdown
Member Author

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

maleadt commented Jul 10, 2025

Copy link
Copy Markdown
Member Author

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.

@amontoison amontoison force-pushed the tb/llvm_spirv_backend branch from 805799c to 8beebc5 Compare August 21, 2025 18:48
@michel2323 michel2323 force-pushed the tb/llvm_spirv_backend branch from 5c96f50 to e506217 Compare August 22, 2025 15:54
@michel2323

Copy link
Copy Markdown
Member

@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?

@michel2323 michel2323 force-pushed the tb/llvm_spirv_backend branch from e506217 to 36260b1 Compare August 29, 2025 13:37
@michel2323

michel2323 commented Aug 29, 2025

Copy link
Copy Markdown
Member

See: JuliaGPU/OpenCL.jl#316

@michel2323 michel2323 force-pushed the tb/llvm_spirv_backend branch 2 times, most recently from 62481c2 to 87b2e88 Compare September 3, 2025 17:52
@michel2323

Copy link
Copy Markdown
Member

@maleadt I've rebased this again cleanly onto master.

@michel2323

Copy link
Copy Markdown
Member

Rebase and now we have an assortment of failures:

  • Julia 1.10: Intel runtime craps out in L0
  • Julia 1.11: The _Z17__spirv_IAddCarryll error
  • Julia 1.12: Silently produces wrong results

I'm inclined to work on 1.12 and make this work some time in a future version.

@maleadt maleadt force-pushed the tb/llvm_spirv_backend branch from 9dd1f35 to c610b8d Compare June 17, 2026 09:26
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.79%. Comparing base (8a3e4b3) to head (c610b8d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #491      +/-   ##
==========================================
+ Coverage   79.74%   80.79%   +1.04%     
==========================================
  Files          48       48              
  Lines        3234     3233       -1     
==========================================
+ Hits         2579     2612      +33     
+ Misses        655      621      -34     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt maleadt marked this pull request as ready for review June 17, 2026 10:48
@maleadt maleadt merged commit 8a688fd into main Jun 17, 2026
5 of 6 checks passed
@maleadt maleadt deleted the tb/llvm_spirv_backend branch June 17, 2026 10:48
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