Skip to content

Conversation

@dyniols
Copy link
Contributor

@dyniols dyniols commented Jan 8, 2026

This PR fixes test-e2e/Basic/buffer/subbuffer.cpp test. It was failing Gen12 OpenCL. #15151

Looks like we incorrectly create subbuffer with size which is smaller than anticipated.

Example

  std::size_t size = 10;
  std::size_t offset = size / 2, subbuf_size = 5, offset_inside_subbuf = 2,
              subbuffer_access_range = subbuf_size - offset_inside_subbuf;
  std::vector<int> vec(size);
  std::iota(vec.begin(), vec.end(), 0);

{
    sycl::buffer<int, 1> buf(vec.data(), size);
    sycl::buffer<int, 1> subbuf(buf, sycl::id<1>(offset),
                                sycl::range<1>(subbuf_size));  
    q.submit([&](sycl::handler &cgh) {
      auto acc = subbuf.get_access<sycl::access::mode::read_write>(
          cgh, sycl::range<1>(subbuffer_access_range),
          sycl::id<1>(offset_inside_subbuf));
      cgh.parallel_for(sycl::range<1>(subbuffer_access_range),
                                     [=](sycl::id<1> i) { 
                                      acc[i] *= -1; });
    });
}

Expected result is 0 1 2 3 4 5 6 -7 -8 -9 but without this change result is 0 1 2 3 4 5 6 -7 8 9

However when MRequirement.MAccessRange is replaced with MRequirement.MMemoryRange we create subbuffer of size just 5 instead of 3 and expected result is valid.

Here is tracker explaining why it happens on Gen12: CMPLRLLVM-72513

@dyniols dyniols marked this pull request as ready for review January 9, 2026 16:04
@dyniols dyniols requested a review from a team as a code owner January 9, 2026 16:04
@dyniols dyniols requested a review from slawekptak January 9, 2026 16:04
Copy link
Contributor

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

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

finally

@github-actions
Copy link
Contributor

@intel/llvm-gatekeepers please consider merging

@dyniols
Copy link
Contributor Author

dyniols commented Jan 13, 2026

@intel/llvm-gatekeepers Can we merge it ? Thanks :)

@kswiecicki kswiecicki merged commit 9ff23b5 into intel:sycl Jan 13, 2026
47 of 49 checks passed
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.

3 participants