Skip to content
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

[SYCL] fix a typo in the comment #9967

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

jinz2014
Copy link
Contributor

No description provided.

@jinz2014 jinz2014 requested a review from a team as a code owner June 18, 2023 21:02
@jinz2014 jinz2014 temporarily deployed to aws June 18, 2023 21:17 — with GitHub Actions Inactive
@jinz2014 jinz2014 temporarily deployed to aws June 18, 2023 21:57 — with GitHub Actions Inactive
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM! NFC so failures are unrelated.

@steffenlarsen steffenlarsen merged commit 9ac8d81 into intel:sycl Jun 23, 2023
@jinz2014
Copy link
Contributor Author

Is a SYCL buffer of size 0 fine ?

  // Accessor with buffer size 0.
  {
    try {
      int data[10] = {0};
      {
        sycl::buffer<int, 1> b{&data[0], 10};
        sycl::buffer<int, 1> b1{0};

        sycl::queue queue;
        queue.submit([&](sycl::handler &cgh) {
          sycl::accessor<int, 1, sycl::access::mode::read_write,
                         sycl::target::device>
              B(b, cgh);
          auto B1 = b1.template get_access<sycl::access::mode::read_write>(cgh);

          cgh.single_task<class acc_with_zero_sized_buffer>(
              [=]() { B[0] = 1; });
        });
      }
      assert(!"invalid device accessor buffer size exception wasn't caught");
    } catch (const sycl::invalid_object_error &e) {
      assert(e.get_cl_code() == CL_INVALID_VALUE);
    } catch (sycl::exception e) {
      std::cout << "SYCL exception caught: " << e.what();
      return 1;
    }
  }

@steffenlarsen
Copy link
Contributor

@jinz2014 - Is this related to this patch? Either way, currently the spec does not disallow zero-sized buffers and does not block the construction of accessors from zero-sized buffers. This is an open issue on the spec however (KhronosGroup/SYCL-Docs#408) as this seems to be differing from the behavior of placeholder accessors on empty buffers, as it will throw when require is called on it.

@jinz2014
Copy link
Contributor Author

No. I took a look at the unrelated failure. Thank you for explaining the issue.

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