-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add experimental implementation of sycl_ext_intel_grf_size #9882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f8991b1
eaa6b3d
c9e55b3
4858edf
6c128ef
f362bc9
55e3001
139fe05
755419a
edc9b6e
010955c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
; Check we create RegisterAllocMode metadata if there is a non-ESIMD kernel with that property | ||
; RUN: opt -passes=compile-time-properties %s -S | FileCheck %s --check-prefix CHECK-IR | ||
|
||
; Function Attrs: convergent norecurse | ||
define weak_odr dso_local spir_kernel void @sycl_grf_size() #1 { | ||
; CHECK-IR-NOT: !RegisterAllocMode | ||
; CHECK-IR: sycl_grf_size() #[[#Attr1:]]{{.*}}!RegisterAllocMode ![[#MDVal:]] { | ||
; CHECK-IR-NOT: !RegisterAllocMode | ||
; CHECK-IR: ![[#MDVal]] = !{i32 2} | ||
entry: | ||
ret void | ||
} | ||
|
||
; Function Attrs: convergent norecurse | ||
define weak_odr dso_local spir_kernel void @sycl_no_grf_size() #0 { | ||
entry: | ||
ret void | ||
} | ||
|
||
; Function Attrs: convergent norecurse | ||
define weak_odr dso_local spir_kernel void @esimd_grf_size() #1 !sycl_explicit_simd !1 { | ||
entry: | ||
ret void | ||
} | ||
|
||
; Function Attrs: convergent norecurse | ||
define weak_odr dso_local spir_kernel void @esimd_no_grf_size() #0 { | ||
entry: | ||
ret void | ||
v-klochkov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
attributes #0 = { convergent norecurse } | ||
attributes #1 = { convergent norecurse "sycl-grf-size"="256" } | ||
|
||
!1 = !{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; This test confirms an error with sycl-register-alloc-mode and sycl-grf-size on the same kernel. | ||
|
||
; RUN: not sycl-post-link -split=source -symbols -split-esimd -lower-esimd -S < %s 2>&1 | FileCheck %s | ||
|
||
; CHECK: Unsupported use of both register_alloc_mode and grf_size | ||
|
||
source_filename = "llvm-link" | ||
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" | ||
target triple = "spir64-unknown-unknown" | ||
|
||
define weak_odr dso_local spir_kernel void @__SYCL_kernel() #0 { | ||
entry: | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" "sycl-grf-size"="256" "sycl-register-alloc-mode"="0"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
; This test checks handling of sycl-grf-size in SYCL post link | ||
|
||
; RUN: sycl-post-link -split=source -symbols -split-esimd -lower-esimd -S < %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; RUN: FileCheck %s -input-file=%t_esimd_0.ll --check-prefixes CHECK-ESIMD-LargeGRF-IR --implicit-check-not='__ESIMD_kernel()' | ||
sarnex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
; RUN: FileCheck %s -input-file=%t_esimd_0.prop --check-prefixes CHECK-ESIMD-LargeGRF-PROP | ||
; RUN: FileCheck %s -input-file=%t_esimd_0.sym --check-prefixes CHECK-ESIMD-LargeGRF-SYM | ||
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-SYCL-LargeGRF-IR --implicit-check-not='__SYCL_kernel()' | ||
; RUN: FileCheck %s -input-file=%t_1.prop --check-prefixes CHECK-SYCL-LargeGRF-PROP | ||
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYCL-LargeGRF-SYM | ||
; RUN: FileCheck %s -input-file=%t_3.ll --check-prefixes CHECK-SYCL-IR --implicit-check-not='__SYCL_kernel_large_grf()' | ||
; RUN: FileCheck %s -input-file=%t_3.prop --check-prefixes CHECK-SYCL-PROP | ||
; RUN: FileCheck %s -input-file=%t_3.sym --check-prefixes CHECK-SYCL-SYM | ||
; RUN: FileCheck %s -input-file=%t_esimd_2.ll --check-prefixes CHECK-ESIMD-IR --implicit-check-not='__ESIMD_large_grf_kernel()' | ||
; RUN: FileCheck %s -input-file=%t_esimd_2.prop --check-prefixes CHECK-ESIMD-PROP | ||
|
||
; CHECK: [Code|Properties|Symbols] | ||
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop|{{.*}}_esimd_0.sym | ||
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop|{{.*}}_1.sym | ||
; CHECK: {{.*}}_esimd_2.ll|{{.*}}_esimd_2.prop|{{.*}}_esimd_2.sym | ||
|
||
; CHECK-ESIMD-LargeGRF-PROP: isEsimdImage=1|1 | ||
; CHECK-ESIMD-LargeGRF-PROP: sycl-grf-size=1|256 | ||
|
||
; CHECK-SYCL-LargeGRF-PROP: sycl-grf-size=1|256 | ||
|
||
; CHECK-SYCL-LargeGRF-IR: define {{.*}} spir_kernel void @__SYCL_kernel_large_grf() #[[SYCLAttr:]] | ||
; CHECK-SYCL-LargeGRF-IR: attributes #[[SYCLAttr]] | ||
|
||
; CHECK-SYCL-PROP-NOT: sycl-grf-size | ||
|
||
; CHECK-SYCL-SYM: __SYCL_kernel | ||
; CHECK-SYCL-SYM-EMPTY: | ||
|
||
; CHECK-SYCL-IR: __SYCL_kernel() #[[SYCLAttr:]] | ||
; CHECK-SYCL-IR: attributes #[[SYCLAttr]] | ||
|
||
; CHECK-SYCL-LargeGRF-SYM: __SYCL_kernel_large_grf | ||
; CHECK-SYCL-LargeGRF-SYM-EMPTY: | ||
|
||
; CHECK-ESIMD-SYM: __ESIMD_kernel | ||
; CHECK-ESIMD-SYM-EMPTY: | ||
|
||
; CHECK-ESIMD-IR: __ESIMD_kernel() #[[ESIMDAttr:]] | ||
; CHECK-ESIMD-IR: attributes #[[ESIMDAttr]] | ||
|
||
; CHECK-ESIMD-PROP-NOT: sycl-grf-size | ||
|
||
; CHECK-ESIMD-LargeGRF-SYM: __ESIMD_large_grf_kernel | ||
; CHECK-ESIMD-LargeGRF-SYM-EMPTY: | ||
|
||
; CHECK-ESIMD-LargeGRF-IR: @__ESIMD_large_grf_kernel() #[[ESIMDLargeAttr:]] | ||
; CHECK-ESIMD-LargeGRF-IR: attributes #[[ESIMDLargeAttr]] | ||
|
||
; ModuleID = 'large_grf.bc' | ||
source_filename = "grf" | ||
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" | ||
target triple = "spir64-unknown-unknown" | ||
|
||
define weak_odr dso_local spir_kernel void @__SYCL_kernel() #0 { | ||
entry: | ||
ret void | ||
} | ||
|
||
define weak_odr dso_local spir_kernel void @__SYCL_kernel_large_grf() #1 { | ||
entry: | ||
ret void | ||
} | ||
|
||
define weak_odr dso_local spir_kernel void @__ESIMD_kernel() #0 !sycl_explicit_simd !0 !intel_reqd_sub_group_size !1 { | ||
entry: | ||
ret void | ||
} | ||
|
||
define weak_odr dso_local spir_kernel void @__ESIMD_large_grf_kernel() #1 !sycl_explicit_simd !0 !intel_reqd_sub_group_size !1 { | ||
entry: | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
attributes #1 = { "sycl-module-id"="a.cpp" "sycl-grf-size"="256" } | ||
|
||
!0 = !{} | ||
!1 = !{i32 1} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,10 @@ struct register_alloc_mode_key { | |
}; | ||
|
||
template <register_alloc_mode_enum Mode> | ||
inline constexpr register_alloc_mode_key::value_t<Mode> register_alloc_mode; | ||
inline constexpr register_alloc_mode_key::value_t<Mode> register_alloc_mode | ||
__SYCL_DEPRECATED("register_alloc_mode is deprecated, " | ||
"use sycl::ext::intel::experimental::grf_size or " | ||
"sycl::ext::intel::experimental::grf_size_automatic"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stdale-intel - Do we want to deprecate this? It has not been in a release yet, to my knowledge. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my POV at least we shouldn't remove it right now, otherwise all of the clients who just ported to using it would have to make yet another change to their code, annoying them even further. |
||
} // namespace detail | ||
|
||
namespace ext::oneapi::experimental { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
//==- grf_size_properties.hpp - GRF size kernel properties for Intel GPUs -==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===--------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include <sycl/ext/oneapi/properties/property.hpp> | ||
#include <sycl/ext/oneapi/properties/property_value.hpp> | ||
|
||
#define SYCL_EXT_INTEL_GRF_SIZE 1 | ||
|
||
namespace sycl { | ||
__SYCL_INLINE_VER_NAMESPACE(_V1) { | ||
namespace ext::intel::experimental { | ||
struct grf_size_key { | ||
template <unsigned int Size> | ||
sarnex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
using value_t = oneapi::experimental::property_value< | ||
grf_size_key, std::integral_constant<unsigned int, Size>>; | ||
}; | ||
|
||
struct grf_size_automatic_key { | ||
using value_t = oneapi::experimental::property_value<grf_size_automatic_key>; | ||
}; | ||
|
||
template <unsigned int Size> | ||
inline constexpr grf_size_key::value_t<Size> grf_size; | ||
|
||
inline constexpr grf_size_automatic_key::value_t grf_size_automatic; | ||
|
||
} // namespace ext::intel::experimental | ||
namespace ext::oneapi::experimental { | ||
sarnex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
template <> | ||
struct is_property_key<sycl::ext::intel::experimental::grf_size_key> | ||
: std::true_type {}; | ||
|
||
template <> | ||
struct is_property_key<sycl::ext::intel::experimental::grf_size_automatic_key> | ||
: std::true_type {}; | ||
|
||
namespace detail { | ||
template <> | ||
struct PropertyToKind<sycl::ext::intel::experimental::grf_size_key> { | ||
static constexpr PropKind Kind = PropKind::GRFSize; | ||
}; | ||
|
||
template <> | ||
struct IsCompileTimeProperty<sycl::ext::intel::experimental::grf_size_key> | ||
: std::true_type {}; | ||
|
||
template <> | ||
struct PropertyToKind<sycl::ext::intel::experimental::grf_size_automatic_key> { | ||
static constexpr PropKind Kind = PropKind::GRFSizeAutomatic; | ||
}; | ||
|
||
template <> | ||
struct IsCompileTimeProperty< | ||
sycl::ext::intel::experimental::grf_size_automatic_key> : std::true_type {}; | ||
|
||
template <unsigned int Size> | ||
struct PropertyMetaInfo< | ||
sycl::ext::intel::experimental::grf_size_key::value_t<Size>> { | ||
static_assert(Size == 128 || Size == 256, "Unsupported GRF size"); | ||
static constexpr const char *name = "sycl-grf-size"; | ||
static constexpr unsigned int value = Size; | ||
}; | ||
template <> | ||
struct PropertyMetaInfo< | ||
sycl::ext::intel::experimental::grf_size_automatic_key::value_t> { | ||
static constexpr const char *name = "sycl-grf-size"; | ||
static constexpr unsigned int value = 0; | ||
}; | ||
|
||
template <typename Properties> | ||
struct ConflictingProperties<sycl::ext::intel::experimental::grf_size_key, | ||
Properties> | ||
: ContainsProperty<sycl::ext::intel::experimental::grf_size_automatic_key, | ||
Properties> {}; | ||
|
||
template <typename Properties> | ||
struct ConflictingProperties< | ||
sycl::ext::intel::experimental::grf_size_automatic_key, Properties> | ||
: ContainsProperty<sycl::ext::intel::experimental::grf_size_key, | ||
Properties> {}; | ||
|
||
sarnex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} // namespace detail | ||
} // namespace ext::oneapi::experimental | ||
} // __SYCL_INLINE_VER_NAMESPACE(_V1) | ||
} // namespace sycl |
Uh oh!
There was an error while loading. Please reload this page.