Skip to content

Added support for cl_ext_float_atomics in CBasicTestFetchAddSpecialFloats with atomic_half#2386

Merged
bashbaug merged 12 commits intoKhronosGroup:mainfrom
shajder:float_atomics_fp16_spec_add
Jan 27, 2026
Merged

Added support for cl_ext_float_atomics in CBasicTestFetchAddSpecialFloats with atomic_half#2386
bashbaug merged 12 commits intoKhronosGroup:mainfrom
shajder:float_atomics_fp16_spec_add

Conversation

@shajder
Copy link
Copy Markdown
Contributor

@shajder shajder commented May 8, 2025

Related to #2142, according to the work plan, extending CBasicTestFetchAddSpecialFloats with support for atomic_half.

@lakshmih
Copy link
Copy Markdown
Contributor

lakshmih commented Nov 7, 2025

Can this be rebased, thanks.

@shajder
Copy link
Copy Markdown
Contributor Author

shajder commented Nov 17, 2025

Can this be rebased, thanks.

Done

Copy link
Copy Markdown
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is "failing" on our device because the incoming values in "finalDest" are all NaN. I have a very time following these tests, so I'm not exactly sure where things are going wrong. Can you please take a look and see what might be happening?

Found by modifying the kernel source to print the initial values:

__kernel void test_atomic_kernel(uint threadCount, uint numDestItems,
                                 __global half *finalDest,
                                 __global half *oldValues,
                                 volatile __local atomic_half *destMemory) {
  uint tid = get_global_id(0);

  // initialize atomics not reachable from host (first thread
  // is doing this, other threads are waiting on barrier)
  if (get_local_id(0) == 0)
    for (uint dstItemIdx = 0; dstItemIdx < numDestItems; dstItemIdx++) {
      printf("At index %u: destMemory is %f\n", dstItemIdx, (float)finalDest[dstItemIdx]);
      atomic_store_explicit(destMemory + dstItemIdx, finalDest[dstItemIdx],
                            memory_order_relaxed, memory_scope_work_group);
    }
  barrier(CLK_LOCAL_MEM_FENCE);
...

This prints:

At index 0: destMemory is -nan
At index 1: destMemory is -nan
At index 2: destMemory is -nan
...

Comment thread test_conformance/c11_atomics/main.cpp Outdated
lakshmih
lakshmih previously approved these changes Dec 5, 2025
@shajder
Copy link
Copy Markdown
Contributor Author

shajder commented Dec 9, 2025

Can you please take a look and see what might be happening?

I can't find any implementation that supports either the CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT or CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT capabilities, so it's difficult to test this feature. I’ll try it on an Arc B570 machine tomorrow, but if you know of any simpler way to access a device that exposes these capabilities, I would appreciate the information. Thanks!

@shajder
Copy link
Copy Markdown
Contributor Author

shajder commented Dec 10, 2025

This test is "failing" on our device because the incoming values in "finalDest" are all NaN. I have a very time following these tests, so I'm not exactly sure where things are going wrong. Can you please take a look and see what might be happening?

I can reproduce the problem now and I am working on it, thanks!

@shajder
Copy link
Copy Markdown
Contributor Author

shajder commented Dec 11, 2025

Can you please take a look and see what might be happening?

Corrected, please review.

Comment thread test_conformance/c11_atomics/common.h Outdated
Comment thread test_conformance/c11_atomics/common.h Outdated
Comment thread test_conformance/c11_atomics/test_atomics.cpp Outdated
@shajder shajder requested a review from bashbaug December 15, 2025 13:11
bashbaug
bashbaug previously approved these changes Jan 22, 2026
Copy link
Copy Markdown
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think these tests are still quite hard to follow and perhaps overly clever, but I think they're correct now, and they execute fairly promptly.

Comment thread test_conformance/c11_atomics/test_atomics.cpp
@bashbaug
Copy link
Copy Markdown
Contributor

Merging as discussed in the January 27th teleconference.

@bashbaug bashbaug merged commit 6f38c79 into KhronosGroup:main Jan 27, 2026
8 checks passed
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.

4 participants