@@ -740,5 +740,52 @@ int main() {
740
740
}
741
741
}
742
742
743
+ // Accessor common property interface
744
+ {
745
+ using namespace sycl ::ext::oneapi;
746
+ int data[1 ] = {0 };
747
+
748
+ // host accessor
749
+ try {
750
+ sycl::buffer<int , 1 > buf_data (data, sycl::range<1 >(1 ),
751
+ {sycl::property::buffer::use_host_ptr ()});
752
+ accessor_property_list PL{no_alias, no_offset, sycl::no_init};
753
+ sycl::accessor acc_1 (buf_data, PL);
754
+ static_assert (acc_1.has_property <property::no_alias>());
755
+ static_assert (acc_1.has_property <property::no_offset>());
756
+ assert (acc_1.has_property <sycl::property::no_init>());
757
+
758
+ static_assert (acc_1.get_property <property::no_alias>() == no_alias);
759
+ static_assert (acc_1.get_property <property::no_offset>() == no_offset);
760
+ // Should not throw "The property is not found"
761
+ auto noInit = acc_1.get_property <sycl::property::no_init>();
762
+ } catch (sycl::exception e) {
763
+ std::cout << " SYCL exception caught: " << e.what () << std::endl;
764
+ }
765
+
766
+ // base accessor
767
+ try {
768
+ sycl::buffer<int , 1 > buf_data (data, sycl::range<1 >(1 ),
769
+ {sycl::property::buffer::use_host_ptr ()});
770
+ sycl::queue q;
771
+ accessor_property_list PL{no_alias, no_offset, sycl::no_init};
772
+
773
+ q.submit ([&](sycl::handler &cgh) {
774
+ sycl::accessor acc_1 (buf_data, PL);
775
+ static_assert (acc_1.has_property <property::no_alias>());
776
+ static_assert (acc_1.has_property <property::no_offset>());
777
+ assert (acc_1.has_property <sycl::property::no_init>());
778
+
779
+ static_assert (acc_1.get_property <property::no_alias>() == no_alias);
780
+ static_assert (acc_1.get_property <property::no_offset>() == no_offset);
781
+ // Should not throw "The property is not found"
782
+ auto noInit = acc_1.get_property <sycl::property::no_init>();
783
+ });
784
+ q.wait ();
785
+ } catch (sycl::exception e) {
786
+ std::cout << " SYCL exception caught: " << e.what () << std::endl;
787
+ }
788
+ }
789
+
743
790
std::cout << " Test passed" << std::endl;
744
791
}
0 commit comments