Skip to content

Commit 5059b50

Browse files
committed
Expand the test for all attributes.
add match files. Signed-off-by: JackAKirk <[email protected]>
1 parent 0ffd0f3 commit 5059b50

6 files changed

+48
-10
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

test/conformance/exp_launch_attributes/exp_launch_attributes_adapter_hip.match

Whitespace-only changes.

test/conformance/exp_launch_attributes/exp_launch_attributes_adapter_level_zero.match

Whitespace-only changes.

test/conformance/exp_launch_attributes/exp_launch_attributes_adapter_native_cpu.match

Whitespace-only changes.

test/conformance/exp_launch_attributes/exp_launch_attributes_adapter_opencl.match

Whitespace-only changes.

test/conformance/exp_launch_attributes/launch_attributes.cpp

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,58 @@ TEST_P(urEnqueueKernelLaunchCustomTest, Success) {
3939
GTEST_SKIP() << "EXP launch attributes feature is not supported.";
4040
}
4141

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+
}
4287
ur_mem_handle_t buffer = nullptr;
4388
AddBuffer1DArg(sizeof(val) * global_size, &buffer);
4489
AddPodArg(val);
4590

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));
5594
ASSERT_SUCCESS(urQueueFinish(queue));
5695
ValidateBuffer(buffer, sizeof(val) * global_size, val);
5796
}

0 commit comments

Comments
 (0)