Skip to content

Commit b409150

Browse files
JackAKirkcallumfare
authored andcommitted
Add cluster_launch device aspect.
this aspect is true only for sm_90 cuda gpus. Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
1 parent c5d3b9d commit b409150

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

include/ur_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,7 @@ typedef enum ur_device_info_t {
16011601
///< command-buffers.
16021602
UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP = 0x1001, ///< [::ur_bool_t] Returns true if the device supports updating the kernel
16031603
///< commands in a command-buffer.
1604+
UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP = 0x1111, ///< [::ur_bool_t] return true if enqueue Cluster Launch is supported
16041605
UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP = 0x2000, ///< [::ur_bool_t] returns true if the device supports the creation of
16051606
///< bindless images
16061607
UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP = 0x2001, ///< [::ur_bool_t] returns true if the device supports the creation of

include/ur_print.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,6 +2530,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
25302530
case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP:
25312531
os << "UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP";
25322532
break;
2533+
case UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP:
2534+
os << "UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP";
2535+
break;
25332536
case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP:
25342537
os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP";
25352538
break;
@@ -4029,6 +4032,18 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info
40294032

40304033
os << ")";
40314034
} break;
4035+
case UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP: {
4036+
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
4037+
if (sizeof(ur_bool_t) > size) {
4038+
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
4039+
return UR_RESULT_ERROR_INVALID_SIZE;
4040+
}
4041+
os << (const void *)(tptr) << " (";
4042+
4043+
os << *tptr;
4044+
4045+
os << ")";
4046+
} break;
40324047
case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: {
40334048
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
40344049
if (sizeof(ur_bool_t) > size) {

scripts/core/exp-launch-properties.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,14 @@ returns:
128128
- $X_RESULT_ERROR_INVALID_VALUE
129129
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
130130
- $X_RESULT_ERROR_OUT_OF_RESOURCES
131+
--- #--------------------------------------------------------------------------
132+
type: enum
133+
extend: true
134+
typed_etors: true
135+
desc: "Extension enums to $x_device_info_t to support arch specific launch properties."
136+
name: $x_device_info_t
137+
etors:
138+
- name: CLUSTER_LAUNCH_EXP
139+
value: "0x1111"
140+
desc: "[$x_bool_t] return true if enqueue Cluster Launch is supported"
131141

source/adapters/cuda/device.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10891089
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
10901090
case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP:
10911091
return ReturnValue(true);
1092+
case UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP: {
1093+
int Value = getAttribute(hDevice,
1094+
CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR) >= 9;
1095+
return ReturnValue(static_cast<bool>(Value));
1096+
}
10921097

10931098
default:
10941099
break;

test/conformance/exp_launch_properties/launch_properties.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ TEST_P(urEnqueueKernelLaunchCustomTest, Success) {
7575
props.push_back(coop_prop);
7676
}
7777

78-
if (compute_capability >= 9.0) {
78+
ur_bool_t cluster_launch_supported = false;
79+
ASSERT_SUCCESS(
80+
urDeviceGetInfo(device, UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP,
81+
sizeof(ur_bool_t), &cluster_launch_supported, nullptr));
82+
83+
if (cluster_launch_supported) {
7984
ur_exp_launch_property_t cluster_dims_prop;
8085
cluster_dims_prop.id = UR_EXP_LAUNCH_PROPERTY_ID_CLUSTER_DIMENSION;
8186
cluster_dims_prop.value.clusterDim[0] = 1;

tools/urinfo/urinfo.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ inline void printDeviceInfos(ur_device_handle_t hDevice,
335335
printDeviceInfo<ur_bool_t>(
336336
hDevice, UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP);
337337
std::cout << prefix;
338+
printDeviceInfo<ur_bool_t>(hDevice, UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP);
339+
std::cout << prefix;
338340
printDeviceInfo<ur_bool_t>(hDevice,
339341
UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP);
340342
std::cout << prefix;

0 commit comments

Comments
 (0)