Skip to content

Remove check-bounds=yes in tests #297

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

blegat
Copy link
Contributor

@blegat blegat commented Mar 28, 2025

The tests are currently failing in CI. I can reproduce it locally they occur in
https://github.com/JuliaGPU/KernelAbstractions.jl/blob/main/test/localmem.jl
I noticed that the failures disappear if I remove --check-bounds=yes.
You can reproduce the failure as follows

$ julia --project=test --check-bounds=yes # v1.11.4
julia> using KernelAbstractions

julia> @kernel function localmem(A)
           N = @uniform prod(@groupsize())
           @uniform begin
               N2 = prod(@groupsize())
           end
           I = @index(Global, Linear)
           i = @index(Local, Linear)
           lmem = @localmem Int (N,) # Ok iff groupsize is static
           @inbounds begin
               lmem[i] = i
               @synchronize
               A[I] = lmem[N2 - i + 1]
           end
       end
localmem (generic function with 4 methods)

julia> using OpenCL, pocl_jll

julia> kernel! = localmem(OpenCLBackend(), 16)
KernelAbstractions.Kernel{OpenCLBackend, KernelAbstractions.NDIteration.StaticSize{(16,)}, KernelAbstractions.NDIteration.DynamicSize, typeof(gpu_localmem)}(OpenCLBackend(), gpu_localmem)

julia> A = CLArray{Int}(undef, 64);

julia> kernel!(A, ndrange = size(A))

julia> Could not find a dominating alternative variable.
[1]    5267 IOT instruction (core dumped)  julia --color=yes --project=test --check-bounds=yes

The same runs fine without the --check-bounds=yes option.
The error comes from https://github.com/pocl/pocl/blob/66aa142309ecd71d0541f3495dc3ae3f9903b03e/lib/llvmopencl/WorkitemHandler.cc#L264

Copy link

codecov bot commented Mar 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.45%. Comparing base (8472a71) to head (560228b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
+ Coverage   72.96%   73.45%   +0.48%     
==========================================
  Files          12       12              
  Lines         614      614              
==========================================
+ Hits          448      451       +3     
+ Misses        166      163       -3     

☔ View full report in Codecov by Sentry.
📢 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
Copy link
Member

maleadt commented Mar 28, 2025

I'm fine doing this temporarily, but we should also open an issue, and if possible only apply this hack to those Julia versions that require it. Also, not all back-ends require this hack (only PoCL), so it may be better to add an option to the test runner, set the Pkg flag based on that, so that the Buildkite pipeline can selectively disable bounds checking only for PoCL and only on the Julia versions that need it.

Copy link

github-actions bot commented Mar 31, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic master) to apply these changes.

Click here to view the suggested changes.
diff --git a/test/runtests.jl b/test/runtests.jl
index 32eb6dc..816a47b 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -30,13 +30,13 @@ if do_help
     println("""
         Usage: runtests.jl [--help] [--list] [--jobs=N] [TESTS...]
 
-                       --help                        Show this text.
-                       --list                        List all available tests.
-                       --verbose                     Print more information during testing.
-                       --quickfail                   Fail the entire run as soon as a single test errored.
-                       --jobs=N                      Launch `N` processes to perform tests (default: Sys.CPU_THREADS).
-                       --platform=NAME               Run tests on the platform named `NAME` (default: all platforms).
-                       --check-bounds={yes*|no|auto} Julia is launched with this argument
+                               --help                        Show this text.
+                               --list                        List all available tests.
+                               --verbose                     Print more information during testing.
+                               --quickfail                   Fail the entire run as soon as a single test errored.
+                               --jobs=N                      Launch `N` processes to perform tests (default: Sys.CPU_THREADS).
+                               --platform=NAME               Run tests on the platform named `NAME` (default: all platforms).
+                               --check-bounds={yes*|no|auto} Julia is launched with this argument
 
                Remaining arguments filter the tests that will be executed.""")
     exit(0)

@blegat
Copy link
Contributor Author

blegat commented Mar 31, 2025

I have done so. Note that I needed --check-bounds=auto, as just removing --check-bounds=yes was not enough apparently, it seems that it was not defaulting to auto for some reason

@maleadt
Copy link
Member

maleadt commented Apr 1, 2025

Thanks for working on this. At the same time, I did have some time to work on OpenCL.jl/PoCL, so I reduced a handful of the remaining issues we're seeing on CI: pocl/pocl#1871 and pocl/pocl#1872. If you don't mind, I'd rather wait a bit to see if this could get quickly fixed upstream rather than disabling the tests here.

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