Skip to content

compiler: Reject host-evaluated guards reading device-written Functions - #3069

Draft
ggorman wants to merge 1 commit into
mainfrom
fix-host-guard-device-data
Draft

ggorman wants to merge 1 commit into
mainfrom
fix-host-guard-device-data

Conversation

@ggorman

@ggorman ggorman commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

On device backends a guard evaluated on the host (outside kernels, or around a host Cluster) read the stale host copy of a Function updated on the device, e.g. if (T[0][2][0] < 1.5F) around a launch. Such guards are now refused with a CompilationError.

Test: test_gpu_common.py::TestPassesEdgeCases::test_guard_reads_device_data[noop|advanced] (a spatial guard is accepted and checked for values, a temporal one is refused).

🤖 Generated with Claude Code

On device backends a guard outside the kernels, or in a Cluster that runs
on the host (e.g., a copy-back to a host Function), is evaluated on the host
against the stale host copy of a Function updated on the device. E.g.,
`if (T[0][2][0] < 1.5F)` around a kernel launch while `T` is written by
another kernel. Raise a CompilationError instead of silently computing
wrong results
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.24%. Comparing base (2707ac9) to head (2f14286).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3069      +/-   ##
==========================================
+ Coverage   84.23%   84.24%   +0.01%     
==========================================
  Files         258      258              
  Lines       57070    57102      +32     
  Branches     4874     4878       +4     
==========================================
+ Hits        48072    48106      +34     
+ Misses       8170     8169       -1     
+ Partials      828      827       -1     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.55% <100.00%> (+0.04%) ⬆️
pytest-gpu-gcc- 78.96% <34.28%> (-0.05%) ⬇️
pytest-gpu-icx- 78.90% <34.28%> (-0.02%) ⬇️
pytest-gpu-nvc-nvidiaX 69.11% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant