@@ -39,19 +39,58 @@ TEST_P(urEnqueueKernelLaunchCustomTest, Success) {
39
39
GTEST_SKIP () << " EXP launch attributes feature is not supported." ;
40
40
}
41
41
42
+ std::vector<ur_exp_launch_attribute_t > attrs (1 );
43
+ attrs[0 ].id = UR_EXP_LAUNCH_ATTRIBUTE_ID_IGNORE;
44
+
45
+ ASSERT_SUCCESS (urDeviceGetInfo (device, UR_DEVICE_INFO_PROFILE, 0 , nullptr ,
46
+ &returned_size));
47
+
48
+ std::unique_ptr<char []> returned_backend (new char [returned_size]);
49
+
50
+ ASSERT_SUCCESS (urDeviceGetInfo (device, UR_DEVICE_INFO_PROFILE, returned_size,
51
+ returned_backend.get (), nullptr ));
52
+
53
+ std::string_view backend_string (returned_backend.get ());
54
+ const bool cuda_backend = backend_string.find (" CUDA" ) != std::string::npos;
55
+
56
+ if (cuda_backend) {
57
+ ASSERT_SUCCESS (urDeviceGetInfo (device, UR_DEVICE_INFO_VERSION, 0 , nullptr ,
58
+ &returned_size));
59
+
60
+ std::unique_ptr<char []> returned_compute_capability (
61
+ new char [returned_size]);
62
+
63
+ ASSERT_SUCCESS (urDeviceGetInfo (device, UR_DEVICE_INFO_VERSION,
64
+ returned_size,
65
+ returned_compute_capability.get (), nullptr ));
66
+
67
+ auto compute_capability =
68
+ std::stof (std::string (returned_compute_capability.get ()));
69
+
70
+ if (compute_capability >= 6.0 ) {
71
+ ur_exp_launch_attribute_t coop_attr;
72
+ coop_attr.id = UR_EXP_LAUNCH_ATTRIBUTE_ID_COOPERATIVE;
73
+ coop_attr.value .cooperative = 1 ;
74
+ attrs.push_back (coop_attr);
75
+ }
76
+
77
+ if (compute_capability >= 9.0 ) {
78
+ ur_exp_launch_attribute_t cluster_dims_attr;
79
+ cluster_dims_attr.id = UR_EXP_LAUNCH_ATTRIBUTE_ID_CLUSTER_DIMENSION;
80
+ cluster_dims_attr.value .clusterDim [0 ] = 32 ;
81
+ cluster_dims_attr.value .clusterDim [1 ] = 1 ;
82
+ cluster_dims_attr.value .clusterDim [2 ] = 1 ;
83
+
84
+ attrs.push_back (cluster_dims_attr);
85
+ }
86
+ }
42
87
ur_mem_handle_t buffer = nullptr ;
43
88
AddBuffer1DArg (sizeof (val) * global_size, &buffer);
44
89
AddPodArg (val);
45
90
46
- ur_exp_launch_attribute_t attr[1 ];
47
- attr[0 ].id = UR_EXP_LAUNCH_ATTRIBUTE_ID_CLUSTER_DIMENSION;
48
- attr[0 ].value .clusterDim [0 ] = global_size;
49
- attr[0 ].value .clusterDim [1 ] = 1 ;
50
- attr[0 ].value .clusterDim [2 ] = 1 ;
51
-
52
- ASSERT_SUCCESS (urEnqueueKernelLaunchCustomExp (queue, kernel, n_dimensions,
53
- &global_size, nullptr , 1 ,
54
- attr, 0 , nullptr , nullptr ));
91
+ ASSERT_SUCCESS (urEnqueueKernelLaunchCustomExp (
92
+ queue, kernel, n_dimensions, &global_size, nullptr , 1 , &attrs[0 ], 0 ,
93
+ nullptr , nullptr ));
55
94
ASSERT_SUCCESS (urQueueFinish (queue));
56
95
ValidateBuffer (buffer, sizeof (val) * global_size, val);
57
96
}
0 commit comments