| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2023 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
// REQUIRES: regkeys, pvc-supported |
| 9 |
|
| 10 |
// windows unsupported due to issues on 32bit build, to be debugged. |
| 11 |
// UNSUPPORTED: system-windows |
| 12 |
|
| 13 |
// checking the asm dump file |
| 14 |
// RUN: ocloc compile -file %s -options " -g -igc_opts 'VISAOptions=-asmToConsole'" -device pvc 2>&1 | FileCheck %s --check-prefix=CHECK-ASM |
| 15 |
// checking the llvm-IR after EmitVISAPass |
| 16 |
// RUN: ocloc compile -file %s -options " -g -igc_opts 'PrintToConsole=1 PrintMDBeforeModule=1 PrintAfter=EmitPass'" -device pvc 2>&1 | FileCheck %s --check-prefix=CHECK-LLVM |
| 17 |
// RUN: ocloc compile -file %s -options " -g -igc_opts 'PrintToConsole=1 PrintMDBeforeModule=1 PrintAfter=EmitPass'" -device pvc 2>&1 | FileCheck %s --check-prefix=CHECK-LLVM2 |
| 18 |
// RUN: ocloc compile -file %s -options " -g -igc_opts 'PrintToConsole=1 PrintMDBeforeModule=1 PrintAfter=EmitPass'" -device pvc 2>&1 | FileCheck %s --check-prefix=CHECK-LLVM3 |
| 19 |
// RUN: ocloc compile -file %s -options " -g -igc_opts 'PrintToConsole=1 PrintMDBeforeModule=1 PrintAfter=EmitPass'" -device pvc 2>&1 | FileCheck %s --check-prefix=CHECK-LLVM4 |
| 20 |
|
| 21 |
// Looking for the comment which informs about the amount of spill size |
| 22 |
// CHECK-ASM: //.private memory size |
| 23 |
// Looking for the comment attached to the instructions ex: |
| 24 |
// (W) store.ugm .... // address space: private; ; $193 |
| 25 |
// CHECK-ASM: address space: private; |
| 26 |
|
| 27 |
// Looking for the MD attached to the instructions ex: |
| 28 |
// store <4 x i32> %39, <4 x i32>* %40, align 4, !user_as_priv !348 ; visa id: 82 |
| 29 |
// %55 = load i32, i32* %54, align 4, !user_as_priv !348 ; visa id: 127 |
| 30 |
// Looking for the reason of not promoting the user variable to grf |
| 31 |
|
| 32 |
|
| 33 |
kernel void test_simple(global int* output) |
| 34 |
{ |
| 35 |
// To force spill of the variable private_array. |
| 36 |
// This will generate the metadata !user_as_priv in LLVM-IR |
| 37 |
// and comment in asm dump "address space: private;" |
| 38 |
int private_array[1024]; |
| 39 |
int private_array_2[1024]; |
| 40 |
|
| 41 |
for(int i = 0; i < 1024; ++i) |
| 42 |
{ |
| 43 |
// Look first for the debugInfo mark which indetify the asign place |
| 44 |
// CHECK-LLVM: [[PA1:![0-9]+]] = !DILocation(line: [[@LINE+7]], column: 22, |
| 45 |
// Look if we have any load/store pointing to the dbg loc which don't have |
| 46 |
// md attribute !user_as_priv |
| 47 |
// regex in POSIX: !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p]) |
| 48 |
// equals negative lookahead !(?!user_as_p) |
| 49 |
// CHECK-LLVM-NOT: {{^ store .*, !dbg }}[[PA1]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 50 |
// CHECK-LLVM-NOT: {{^ .* = load .*, !dbg }}[[PA1]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 51 |
private_array[i] = i; |
| 52 |
} |
| 53 |
|
| 54 |
for(int i = 1023; i >= 0 ; --i) |
| 55 |
{ |
| 56 |
// CHECK-LLVM2: [[PA2:![0-9]+]] = !DILocation(line: [[@LINE+3]], column: 21, |
| 57 |
// CHECK-LLVM2-NOT: {{^ store .*, !dbg }}[[PA2]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 58 |
// CHECK-LLVM2-NOT: {{^ .* = load .*, !dbg }}[[PA2]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 59 |
const int tmp = private_array[i]; |
| 60 |
// CHECK-LLVM3: [[PA3:![0-9]+]] = !DILocation(line: [[@LINE+3]], column: 24, |
| 61 |
// CHECK-LLVM3-NOT: {{^ store .*, !dbg }}[[PA3]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 62 |
// CHECK-LLVM3-NOT: {{^ .* = load .*, !dbg }}[[PA3]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 63 |
private_array_2[i] = tmp; |
| 64 |
} |
| 65 |
|
| 66 |
for(int i = 0; i < 1024; ++i) |
| 67 |
{ |
| 68 |
// CHECK-LLVM4: [[PA4:![0-9]+]] = !DILocation(line: [[@LINE+3]], column: 21, |
| 69 |
// CHECK-LLVM4-NOT: {{^ store .*, !dbg }}[[PA4]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 70 |
// CHECK-LLVM4-NOT: {{^ .* = load .*, !dbg }}[[PA4]]{{, !([^u]|u[^s]|us[^e]|use[^r]|user[^_]|user_[^a]|user_a[^s]|user_as[^_]|user_as_[^p])}} |
| 71 |
const int tmp = private_array_2[i]; |
| 72 |
output[i] = tmp; |
| 73 |
} |
| 74 |
} |