Skip to content

Commit d671fcb

Browse files
committed
[SYCL] Add esimd device descriptor for 2d load/store
1 parent 8740832 commit d671fcb

File tree

7 files changed

+93
-7
lines changed

7 files changed

+93
-7
lines changed

sycl/doc/extensions/supported/sycl_ext_intel_esimd/sycl_ext_intel_esimd.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- [__regcall Calling convention](#__regcall-calling-convention)
3232
- [Inline assembly](#inline-assembly)
3333
- [Device aspect](#device-aspect)
34+
- [Device Information Descriptors](#device-information-descriptors)
3435
- [Device queries and conditional dispatching of the code](#device-queries-and-conditional-dispatching-of-the-code)
3536
- [Implementation restrictions](#implementation-restrictions)
3637
- [Features not supported with the ESIMD extension](#features-not-supported-with-the-esimd-extension)
@@ -1018,6 +1019,11 @@ The new aspect has the following behavior when queried via `device::has()`:
10181019
|--------|-------------|
10191020
|`aspect::ext_intel_esimd` | Indicates that the device supports the `sycl_ext_intel_esimd` extension as defined in this document. |
10201021

1022+
## Device Information Descriptors
1023+
| Device Descriptors | Return Type | Description |
1024+
| ------------------ | ----------- | ----------- |
1025+
| `ext::intel::esimd::info::device::has_2d_block_io_support` | bool | Returns the boolean indicating whether 2D load/store/prefetch instructions are supported by the device. |
1026+
10211027
## Examples
10221028
### Vector addition (USM)
10231029
```cpp

sycl/doc/extensions/supported/sycl_ext_intel_esimd/sycl_ext_intel_esimd_functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ Loads and returns a vector `simd<T, N>` where `N` is `BlockWidth * BlockHeight *
552552
`props` - The optional compile-time properties. Only cache hint properties are used.
553553
554554
### Restrictions
555-
* This function is available only for Intel® Data Center GPU Max Series (aka PVC).
555+
* This function is available only for devices with the `ext::intel::esimd::info::device::has_2d_block_io_support` information descriptor value equal to `true`.
556556
* `Cache-hint` properties, if passed, must follow the [rules](#valid-combinations-of-l1-and-l2-cache-hints-for-load-functions) for `load` functions.
557557
* `Transformed` and `Transposed` cannot be set to true at the same time.
558558
* `BlockWidth` * `BlockHeight` * `NBlocks` * sizeof(`T`) must not exceed 2048.
@@ -598,7 +598,7 @@ Prefetches elements from a memory block of the size `BlockWidth * BlockHeight *
598598
`props` - The compile-time properties, which must specify cache-hints.
599599

600600
### Restrictions
601-
* This function is available only for Intel® Data Center GPU Max Series (aka PVC).
601+
* This function is available only for devices with the `ext::intel::esimd::info::device::has_2d_block_io_support` information descriptor value equal to `true`.
602602
* `Cache-hint` properties must follow the [rules](#valid-combinations-of-l1-and-l2-cache-hints-for-prefetch-functions) for `prefetch` functions.
603603
* `BlockWidth` * `BlockHeight` * `NBlocks` * sizeof(`T`) must not exceed 2048.
604604
* `NBlocks` must be {1,2,4} for `bytes` and `words`, {1,2} for `dwords`, 1 for `qwords`.
@@ -630,7 +630,7 @@ Stores the vector `Vals` of the type `simd<T, N>` to 2D memory block where `N` i
630630
`props` - The optional compile-time properties. Only cache hint properties are used.
631631
632632
### Restrictions
633-
* This function is available only for Intel® Data Center GPU Max Series (aka PVC).
633+
* This function is available only for devices with the `ext::intel::esimd::info::device::has_2d_block_io_support` information descriptor value equal to `true`.
634634
* `Cache-hint` properties, if passed, must follow the [rules](#valid-combinations-of-l1-and-l2-cache-hints-for-store-functions) for `store` functions.
635635
* `BlockWidth` * `BlockHeight` * sizeof(`T`) must not exceed 512.
636636
* `BlockHeight` must not exceed 8.

sycl/include/sycl/info/ext_intel_device_traits.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ __SYCL_PARAM_TRAITS_SPEC(ext::intel, device, free_memory, uint64_t, UR_DEVICE_IN
1616
__SYCL_PARAM_TRAITS_SPEC(ext::intel, device, memory_clock_rate, uint32_t, UR_DEVICE_INFO_MEMORY_CLOCK_RATE)
1717
__SYCL_PARAM_TRAITS_SPEC(ext::intel, device, memory_bus_width, uint32_t, UR_DEVICE_INFO_MEMORY_BUS_WIDTH)
1818
__SYCL_PARAM_TRAITS_SPEC(ext::intel, device, max_compute_queue_indices, int32_t, UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES)
19+
__SYCL_PARAM_TRAITS_SPEC(ext::intel::esimd, device, has_2d_block_io_support, bool, UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP)
1920
#ifdef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC_NEEDS_UNDEF
2021
#undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
2122
#undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC_NEEDS_UNDEF

sycl/source/detail/device_info.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,21 @@ get_device_info<ext::intel::info::device::memory_bus_width>(
15631563
return get_device_info_impl<Param::return_type, Param>::get(Dev);
15641564
}
15651565

1566+
template <>
1567+
inline ext::intel::esimd::info::device::has_2d_block_io_support::return_type
1568+
get_device_info<ext::intel::esimd::info::device::has_2d_block_io_support>(
1569+
const DeviceImplPtr &Dev) {
1570+
ur_exp_device_2d_block_array_capability_flags_t BlockArrayCapabilities;
1571+
Dev->getAdapter()->call<UrApiKind::urDeviceGetInfo>(
1572+
Dev->getHandleRef(),
1573+
UrInfoCode<
1574+
ext::intel::esimd::info::device::has_2d_block_io_support>::value,
1575+
sizeof(BlockArrayCapabilities), &BlockArrayCapabilities, nullptr);
1576+
return BlockArrayCapabilities &
1577+
(UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD |
1578+
UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE);
1579+
}
1580+
15661581
// Returns the list of all progress guarantees that can be requested for
15671582
// work_groups from the coordination level of root_group when using the device
15681583
// given by Dev. First it calls getProgressGuarantee to get the strongest
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: %{build} -o %t.out
2+
// RUN: %{run} %t.out
3+
4+
// Test to check has_2d_block_io_supported device descriptor.
5+
6+
#include <sycl/detail/core.hpp>
7+
#include <sycl/ext/intel/esimd.hpp>
8+
9+
namespace syclex = sycl::ext::oneapi::experimental;
10+
11+
int main() {
12+
sycl::queue Q(sycl::gpu_selector_v);
13+
14+
// if architecture is pvc, then has_2d_block_io_support is expected to be
15+
// true.
16+
auto Arch = Q.get_device().get_info<syclex::info::device::architecture>();
17+
bool Has2DBlockIOSupport =
18+
Q.get_device()
19+
.get_info<
20+
sycl::ext::intel::esimd::info::device::has_2d_block_io_support>();
21+
if (Arch == syclex::architecture::intel_gpu_pvc) {
22+
if (!Has2DBlockIOSupport) {
23+
std::cerr << "Error: has_2d_block_io_support is expected to be true for "
24+
"PVC architecture"
25+
<< std::endl;
26+
return 1;
27+
}
28+
}
29+
if (Arch == syclex::architecture::intel_gpu_tgllp ||
30+
Arch == syclex::architecture::intel_gpu_dg2_g10 ||
31+
Arch == syclex::architecture::intel_gpu_dg2_g11 ||
32+
Arch == syclex::architecture::intel_gpu_dg2_g12) {
33+
if (Has2DBlockIOSupport) {
34+
std::cerr << "Error: has_2d_block_io_support is expected to be false for "
35+
"Tiger Lake and DG2"
36+
<< std::endl;
37+
return 1;
38+
}
39+
}
40+
return 0;
41+
}

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,6 +3242,10 @@ _ZN4sycl3_V16detail13lgamma_r_implEfPi
32423242
_ZN4sycl3_V16detail13make_platformEmNS0_7backendE
32433243
_ZN4sycl3_V16detail13select_deviceERKSt8functionIFiRKNS0_6deviceEEE
32443244
_ZN4sycl3_V16detail13select_deviceERKSt8functionIFiRKNS0_6deviceEEERKNS0_7contextE
3245+
_ZN4sycl3_V16detail14SubmissionInfo14SecondaryQueueEv
3246+
_ZN4sycl3_V16detail14SubmissionInfo17PostProcessorFuncEv
3247+
_ZN4sycl3_V16detail14SubmissionInfoC1Ev
3248+
_ZN4sycl3_V16detail14SubmissionInfoC2Ev
32453249
_ZN4sycl3_V16detail14addCounterInitERNS0_7handlerERSt10shared_ptrINS1_10queue_implEERS4_IiE
32463250
_ZN4sycl3_V16detail14getBorderColorENS0_19image_channel_orderE
32473251
_ZN4sycl3_V16detail14tls_code_loc_t5queryEv
@@ -3251,10 +3255,6 @@ _ZN4sycl3_V16detail14tls_code_loc_tC2ERKNS1_13code_locationE
32513255
_ZN4sycl3_V16detail14tls_code_loc_tC2Ev
32523256
_ZN4sycl3_V16detail14tls_code_loc_tD1Ev
32533257
_ZN4sycl3_V16detail14tls_code_loc_tD2Ev
3254-
_ZN4sycl3_V16detail14SubmissionInfo14SecondaryQueueEv
3255-
_ZN4sycl3_V16detail14SubmissionInfo17PostProcessorFuncEv
3256-
_ZN4sycl3_V16detail14SubmissionInfoC1Ev
3257-
_ZN4sycl3_V16detail14SubmissionInfoC2Ev
32583258
_ZN4sycl3_V16detail16AccessorBaseHost10getAccDataEv
32593259
_ZN4sycl3_V16detail16AccessorBaseHost14getAccessRangeEv
32603260
_ZN4sycl3_V16detail16AccessorBaseHost14getMemoryRangeEv
@@ -3675,6 +3675,7 @@ _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel4info6device25gpu_eu_co
36753675
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel4info6device25max_compute_queue_indicesEEENT_11return_typeEv
36763676
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel4info6device4uuidEEENT_11return_typeEv
36773677
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel4info6device9device_idEEENT_11return_typeEv
3678+
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel5esimd4info6device23has_2d_block_io_supportEEENT_11return_typeEv
36783679
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device12architectureEEENT_11return_typeEv
36793680
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi1EEEEENT_11return_typeEv
36803681
_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi2EEEEENT_11return_typeEv
@@ -3780,6 +3781,7 @@ _ZNK4sycl3_V16device13get_info_implINS0_3ext5intel4info6device25gpu_eu_count_per
37803781
_ZNK4sycl3_V16device13get_info_implINS0_3ext5intel4info6device25max_compute_queue_indicesEEENS0_6detail11ABINeutralTINS8_19is_device_info_descIT_E11return_typeEE4typeEv
37813782
_ZNK4sycl3_V16device13get_info_implINS0_3ext5intel4info6device4uuidEEENS0_6detail11ABINeutralTINS8_19is_device_info_descIT_E11return_typeEE4typeEv
37823783
_ZNK4sycl3_V16device13get_info_implINS0_3ext5intel4info6device9device_idEEENS0_6detail11ABINeutralTINS8_19is_device_info_descIT_E11return_typeEE4typeEv
3784+
_ZNK4sycl3_V16device13get_info_implINS0_3ext5intel5esimd4info6device23has_2d_block_io_supportEEENS0_6detail11ABINeutralTINS9_19is_device_info_descIT_E11return_typeEE4typeEv
37833785
_ZNK4sycl3_V16device13get_info_implINS0_3ext6oneapi12experimental4info6device12architectureEEENS0_6detail11ABINeutralTINS9_19is_device_info_descIT_E11return_typeEE4typeEv
37843786
_ZNK4sycl3_V16device13get_info_implINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi1EEEEENS0_6detail11ABINeutralTINSA_19is_device_info_descIT_E11return_typeEE4typeEv
37853787
_ZNK4sycl3_V16device13get_info_implINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi2EEEEENS0_6detail11ABINeutralTINSA_19is_device_info_descIT_E11return_typeEE4typeEv

sycl/unittests/kernel-and-program/DeviceInfo.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ static ur_result_t redefinedDeviceGetInfo(void *pParams) {
7272
}
7373
}
7474

75+
if (*params.ppropName == UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP) {
76+
assert(*params.ppropSize ==
77+
sizeof(ur_exp_device_2d_block_array_capability_flags_t));
78+
if (*params.ppPropValue) {
79+
*static_cast<ur_exp_device_2d_block_array_capability_flags_t *>(
80+
*params.ppPropValue) =
81+
UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD |
82+
UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE;
83+
}
84+
}
7585
return UR_RESULT_SUCCESS;
7686
}
7787

@@ -185,6 +195,17 @@ TEST_F(DeviceInfoTest, GetDeviceMemoryBusWidth) {
185195
<< "Expect memory_bus_width to be of uint32_t size";
186196
}
187197

198+
TEST_F(DeviceInfoTest, GetDeviceESIMD2DBlockIOSupport) {
199+
context Ctx{Plt.get_devices()[0]};
200+
TestContext.reset(new TestCtx(Ctx));
201+
202+
device Dev = Ctx.get_devices()[0];
203+
204+
auto HasSupport =
205+
Dev.get_info<ext::intel::esimd::info::device::has_2d_block_io_support>();
206+
EXPECT_TRUE(HasSupport);
207+
}
208+
188209
TEST_F(DeviceInfoTest, BuiltInKernelIDs) {
189210
context Ctx{Plt.get_devices()[0]};
190211
TestContext.reset(new TestCtx(Ctx));

0 commit comments

Comments
 (0)