@@ -18,6 +18,10 @@ class MyUInt32Const;
1818class MyFloatConst ;
1919class MyDoubleConst ;
2020
21+ namespace test {
22+ class MySpecConstantWithinANamespace ;
23+ };
24+
2125int main () {
2226 // Create specialization constants.
2327 cl::sycl::ONEAPI::experimental::spec_constant<bool , MyBoolConst> i1 (false );
@@ -32,13 +36,31 @@ int main() {
3236 cl::sycl::ONEAPI::experimental::spec_constant<unsigned int , MyUInt32Const> ui32 (0 );
3337 cl::sycl::ONEAPI::experimental::spec_constant<float , MyFloatConst> f32 (0 );
3438 cl::sycl::ONEAPI::experimental::spec_constant<double , MyDoubleConst> f64 (0 );
39+ // Kernel name can be used as a spec constant name
40+ cl::sycl::ONEAPI::experimental::spec_constant<int , SpecializedKernel> spec1 (0 );
41+ // Spec constant name can be declared within a namespace
42+ cl::sycl::ONEAPI::experimental::spec_constant<int , test::MySpecConstantWithinANamespace> spec2 (0 );
3543
3644 double val;
3745 double *ptr = &val; // to avoid "unused" warnings
3846
47+ // CHECK: // Forward declarations of templated spec constant types:
48+ // CHECK: class MyInt8Const;
49+ // CHECK: class MyUInt8Const;
50+ // CHECK: class MyInt16Const;
51+ // CHECK: class MyUInt16Const;
52+ // CHECK: class MyInt32Const;
53+ // CHECK: class MyUInt32Const;
54+ // CHECK: class MyFloatConst;
55+ // CHECK: class MyDoubleConst;
56+ // CHECK: class SpecializedKernel;
57+ // CHECK: namespace test {
58+ // CHECK: class MySpecConstantWithinANamespace;
59+ // CHECK: }
60+
3961 cl::sycl::kernel_single_task<SpecializedKernel>([=]() {
4062 *ptr = i1.get () +
41- // CHECK-DAG: template <> struct sycl::detail::SpecConstantInfo<class MyBoolConst> {
63+ // CHECK-DAG: template <> struct sycl::detail::SpecConstantInfo<:: MyBoolConst> {
4264 // CHECK-DAG-NEXT: static constexpr const char* getName() {
4365 // CHECK-DAG-NEXT: return "_ZTS11MyBoolConst";
4466 // CHECK-DAG-NEXT: }
@@ -58,7 +80,11 @@ int main() {
5880 // CHECK-DAG: return "_ZTS13MyUInt32Const";
5981 f32 .get () +
6082 // CHECK-DAG: return "_ZTS12MyFloatConst";
61- f64 .get ();
62- // CHECK-DAG: return "_ZTS13MyDoubleConst";
83+ f64 .get () +
84+ // CHECK-DAG: return "_ZTS13MyDoubleConst";
85+ spec1.get () +
86+ // CHECK-DAG: return "_ZTS17SpecializedKernel"
87+ spec2.get ();
88+ // CHECK-DAG: return "_ZTSN4test30MySpecConstantWithinANamespaceE"
6389 });
6490}
0 commit comments