Skip to content

Add a compile-only test grid for Base math on the device - #644

Merged
michel2323 merged 1 commit into
mainfrom
codegen-grid
Sep 25, 2026
Merged

michel2323 merged 1 commit into
mainfrom
codegen-grid

Conversation

@michel2323

@michel2323 michel2323 commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Split out of #621, as suggested there; the allocator part landed in #631.

What

test/device/codegen.jl compiles ~200 (function, eltype) cells — sqrt, exp, log, trig, x^x, div/rem/mod, checked_*, float→int conversions, bounds-checked indexing, Diagonal setindex!, … over Float16/32/64, their complex types and Int32/64, UInt32/64 — through compile_to_obj, the validating path a launch takes (the code_* reflection entry points skip IR validation). Nothing is launched, so it takes seconds.

Why

Whether a Base function compiles for the device depends on which of its throw paths survive optimization, so a routine Julia/GPUCompiler/LLVM/translator bump can silently change the answer. GPUCompiler 2.2.2 did, for sqrt(::Complex) (JuliaGPU/GPUCompiler.jl#906), and it surfaced as an InvalidIRError deep inside gpuarrays/statistics. With this grid, such a regression fails a test named after its cell (e.g. unary complex/sqrt(ComplexF32)).

Known failures

Compiles ~200 (function, eltype) cells through the validating pipeline
(`compile_to_obj`) without launching anything, so a toolchain bump that
stops e.g. `sqrt(::ComplexF32)` from compiling names its cell instead of
failing deep inside a GPUArrays test.

The LLVM SPIR-V back-end compiles every cell. The Khronos translator (LTS
stack) still rejects `_cpow`'s i63 and `llvm.smul.with.overflow`; since the
library-based translator exits the process on those errors, the cells are
skipped on that path rather than marked broken.

Split out of #621.
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #644      +/-   ##
==========================================
- Coverage   81.61%   80.72%   -0.89%     
==========================================
  Files          50       54       +4     
  Lines        3611     3855     +244     
==========================================
+ Hits         2947     3112     +165     
- Misses        664      743      +79     

☔ 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.

@michel2323
michel2323 merged commit ef0e27a into main Sep 25, 2026
5 checks passed
@michel2323
michel2323 deleted the codegen-grid branch September 25, 2026 12:47
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.

1 participant