-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new intrinsic: sub group clustered broadcast
Adds new intrinsic: sub group clustered broadcast. Initial implementation has a set of restrictions: * Supports only cluster size 8 or 16. * Supports only constant cluster size and cluster line.
- Loading branch information
1 parent
4ebc428
commit 0ae060e
Showing
13 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
;=========================== begin_copyright_notice ============================ | ||
; | ||
; Copyright (C) 2024 Intel Corporation | ||
; | ||
; SPDX-License-Identifier: MIT | ||
; | ||
;============================ end_copyright_notice ============================= | ||
; | ||
; RUN: igc_opt -debugify --igc-promoteint8type -check-debugify -S < %s 2>&1 | FileCheck %s | ||
; ------------------------------------------------ | ||
; PromoteInt8Type | ||
; ------------------------------------------------ | ||
|
||
; Debug-info related check | ||
; CHECK-NOT: WARNING | ||
; CHECK: CheckModuleDebugify: PASS | ||
|
||
define i8 @test_clustered_broadcast(i8 %src1, i32 %lane) { | ||
; CHECK-LABEL: @test_clustered_broadcast( | ||
; CHECK: [[B2S1:%.*]] = sext i8 [[SRC1:%.*]] to i16 | ||
; CHECK: [[B2S2:%.*]] = call i16 @llvm.genx.GenISA.WaveClusteredBroadcast.i16(i16 [[B2S1]], i32 8, i32 %lane, i32 0) | ||
; CHECK: [[TMP1:%.*]] = trunc i16 [[B2S2]] to i8 | ||
; CHECK: ret i8 [[TMP1]] | ||
; | ||
%1 = call i8 @llvm.genx.GenISA.WaveClusteredBroadcast.i8(i8 %src1, i32 8, i32 %lane, i32 0) | ||
ret i8 %1 | ||
} | ||
|
||
declare i8 @llvm.genx.GenISA.WaveClusteredBroadcast.i8(i8, i32, i32, i32) |
101 changes: 101 additions & 0 deletions
101
IGC/Compiler/tests/SubGroupFuncsResolution/subgroup_clustered_broadcast.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
;=========================== begin_copyright_notice ============================ | ||
; | ||
; Copyright (C) 2024 Intel Corporation | ||
; | ||
; SPDX-License-Identifier: MIT | ||
; | ||
;============================ end_copyright_notice ============================= | ||
; | ||
; RUN: igc_opt -debugify --igc-sub-group-func-resolution -check-debugify -S < %s 2>&1 | FileCheck %s | ||
; ------------------------------------------------ | ||
; SubGroupFuncsResolution | ||
; ------------------------------------------------ | ||
|
||
; Debug-info related check | ||
; CHECK-NOT: WARNING | ||
; CHECK: CheckModuleDebugify: PASS | ||
|
||
define i1 @test_clustered_broadcast_i1(i1 %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_i1( | ||
; CHECK: [[TMP1:%.*]] = call i1 @llvm.genx.GenISA.WaveClusteredBroadcast.i1(i1 %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret i1 [[TMP1]] | ||
; | ||
%1 = call spir_func i1 @__builtin_IB_simd_clustered_broadcast_b(i1 %src, i32 8, i32 5) | ||
ret i1 %1 | ||
} | ||
|
||
define i8 @test_clustered_broadcast_i8(i8 %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_i8( | ||
; CHECK: [[TMP1:%.*]] = call i8 @llvm.genx.GenISA.WaveClusteredBroadcast.i8(i8 %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret i8 [[TMP1]] | ||
; | ||
%1 = call spir_func i8 @__builtin_IB_simd_clustered_broadcast_c(i8 %src, i32 8, i32 5) | ||
ret i8 %1 | ||
} | ||
|
||
define i16 @test_clustered_broadcast_i16(i16 %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_i16( | ||
; CHECK: [[TMP1:%.*]] = call i16 @llvm.genx.GenISA.WaveClusteredBroadcast.i16(i16 %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret i16 [[TMP1]] | ||
; | ||
%1 = call spir_func i16 @__builtin_IB_simd_clustered_broadcast_us(i16 %src, i32 8, i32 5) | ||
ret i16 %1 | ||
} | ||
|
||
define i32 @test_clustered_broadcast_i32(i32 %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_i32( | ||
; CHECK: [[TMP1:%.*]] = call i32 @llvm.genx.GenISA.WaveClusteredBroadcast.i32(i32 %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret i32 [[TMP1]] | ||
; | ||
%1 = call spir_func i32 @__builtin_IB_simd_clustered_broadcast(i32 %src, i32 8, i32 5) | ||
ret i32 %1 | ||
} | ||
|
||
define float @test_clustered_broadcast_float(float %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_float( | ||
; CHECK: [[TMP1:%.*]] = call float @llvm.genx.GenISA.WaveClusteredBroadcast.f32(float %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret float [[TMP1]] | ||
; | ||
%1 = call spir_func float @__builtin_IB_simd_clustered_broadcast_f(float %src, i32 8, i32 5) | ||
ret float %1 | ||
} | ||
|
||
define half @test_clustered_broadcast_half(half %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_half( | ||
; CHECK: [[TMP1:%.*]] = call half @llvm.genx.GenISA.WaveClusteredBroadcast.f16(half %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret half [[TMP1]] | ||
; | ||
%1 = call spir_func half @__builtin_IB_simd_clustered_broadcast_h(half %src, i32 8, i32 5) | ||
ret half %1 | ||
} | ||
|
||
define double @test_clustered_broadcast_double(double %src) { | ||
; CHECK-LABEL: @test_clustered_broadcast_double( | ||
; CHECK: [[TMP1:%.*]] = call double @llvm.genx.GenISA.WaveClusteredBroadcast.f64(double %src, i32 8, i32 5, i32 0) | ||
; CHECK: ret double [[TMP1]] | ||
; | ||
%1 = call spir_func double @__builtin_IB_simd_clustered_broadcast_df(double %src, i32 8, i32 5) | ||
ret double %1 | ||
} | ||
|
||
define float @test_clustered_broadcast_invalid_cluster_size(float %src, i32 %arg) { | ||
; CHECK: error: cluster_size argument in clustered_broadcast must be constant. | ||
; CHECK: in function: 'test_clustered_broadcast_invalid_cluster_size' | ||
%1 = call spir_func float @__builtin_IB_simd_clustered_broadcast_f(float %src, i32 %arg, i32 5) | ||
ret float %1 | ||
} | ||
|
||
define float @test_clustered_broadcast_invalid_cluster_lane(float %src, i32 %arg) { | ||
; CHECK: error: in_cluster_lane argument in clustered_broadcast must be constant. | ||
; CHECK: in function: 'test_clustered_broadcast_invalid_cluster_lane' | ||
%1 = call spir_func float @__builtin_IB_simd_clustered_broadcast_f(float %src, i32 8, i32 %arg) | ||
ret float %1 | ||
} | ||
|
||
declare spir_func i1 @__builtin_IB_simd_clustered_broadcast_b(i1, i32, i32) | ||
declare spir_func i8 @__builtin_IB_simd_clustered_broadcast_c(i8, i32, i32) | ||
declare spir_func i16 @__builtin_IB_simd_clustered_broadcast_us(i16, i32, i32) | ||
declare spir_func i32 @__builtin_IB_simd_clustered_broadcast(i32, i32, i32) | ||
declare spir_func float @__builtin_IB_simd_clustered_broadcast_f(float, i32, i32) | ||
declare spir_func half @__builtin_IB_simd_clustered_broadcast_h(half, i32, i32) | ||
declare spir_func double @__builtin_IB_simd_clustered_broadcast_df(double, i32, i32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters