Skip to content

Commit e2afeb7

Browse files
sarnexmdtoguchi
authored andcommitted
[SYCL] Move GRF property conflict check to compile time (intel#10116)
Using the new property conflict checking infrastructure, we can do the `sycl::detail::register_alloc_mode` vs `sycl::experimental::intel::grf_size`/`sycl::experimental::intel::grf_size_automatic` check at compile time. We already do `sycl::experimental::intel::grf_size` vs `sycl::experimental::intel::grf_size_automatic` at compile time. I can add a test if we think it has value, but my initial reaction is we would mostly be testing the conflicting checking infrastructure, which we already have tests for. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 86461b3 commit e2afeb7

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

llvm/test/tools/sycl-post-link/grf-size-conflict.ll

Lines changed: 0 additions & 16 deletions
This file was deleted.

llvm/tools/sycl-post-link/sycl-post-link.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,11 @@ std::string saveModuleProperties(module_split::ModuleDesc &MD,
454454
if (MD.isESIMD()) {
455455
PropSet[PropSetRegTy::SYCL_MISC_PROP].insert({"isEsimdImage", true});
456456
}
457-
bool HasRegAllocMode = false;
458457
{
459458
StringRef RegAllocModeAttr = "sycl-register-alloc-mode";
460459
uint32_t RegAllocModeVal;
461460

462-
HasRegAllocMode = llvm::any_of(MD.entries(), [&](const Function *F) {
461+
bool HasRegAllocMode = llvm::any_of(MD.entries(), [&](const Function *F) {
463462
if (!F->hasFnAttribute(RegAllocModeAttr))
464463
return false;
465464
const auto &Attr = F->getFnAttribute(RegAllocModeAttr);
@@ -484,9 +483,6 @@ std::string saveModuleProperties(module_split::ModuleDesc &MD,
484483
return true;
485484
});
486485
if (HasGRFSize) {
487-
if (HasRegAllocMode)
488-
error("Unsupported use of both register_alloc_mode and "
489-
"grf_size");
490486
PropSet[PropSetRegTy::SYCL_MISC_PROP].insert({GRFSizeAttr, GRFSizeVal});
491487
}
492488
}

sycl/include/sycl/ext/intel/experimental/grf_size_properties.hpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#pragma once
1010

11+
#include <sycl/detail/kernel_properties.hpp>
1112
#include <sycl/ext/oneapi/properties/property.hpp>
1213
#include <sycl/ext/oneapi/properties/property_value.hpp>
1314

@@ -77,14 +78,30 @@ struct PropertyMetaInfo<
7778
template <typename Properties>
7879
struct ConflictingProperties<sycl::ext::intel::experimental::grf_size_key,
7980
Properties>
80-
: ContainsProperty<sycl::ext::intel::experimental::grf_size_automatic_key,
81-
Properties> {};
81+
: std::bool_constant<
82+
ContainsProperty<
83+
sycl::ext::intel::experimental::grf_size_automatic_key,
84+
Properties>::value ||
85+
ContainsProperty<sycl::detail::register_alloc_mode_key,
86+
Properties>::value> {};
8287

8388
template <typename Properties>
8489
struct ConflictingProperties<
8590
sycl::ext::intel::experimental::grf_size_automatic_key, Properties>
86-
: ContainsProperty<sycl::ext::intel::experimental::grf_size_key,
87-
Properties> {};
91+
: std::bool_constant<
92+
ContainsProperty<sycl::ext::intel::experimental::grf_size_key,
93+
Properties>::value ||
94+
ContainsProperty<sycl::detail::register_alloc_mode_key,
95+
Properties>::value> {};
96+
97+
template <typename Properties>
98+
struct ConflictingProperties<sycl::detail::register_alloc_mode_key, Properties>
99+
: std::bool_constant<
100+
ContainsProperty<sycl::ext::intel::experimental::grf_size_key,
101+
Properties>::value ||
102+
ContainsProperty<
103+
sycl::ext::intel::experimental::grf_size_automatic_key,
104+
Properties>::value> {};
88105

89106
} // namespace detail
90107
} // namespace ext::oneapi::experimental

0 commit comments

Comments
 (0)