From 120b8fba7ce730308b5a07faf530dcdc8705f541 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 30 Sep 2015 10:30:21 -0400 Subject: [PATCH] P4 to Git Change 1195825 by yaxunl@yaxunl_stg_win50 on 2015/09/30 07:45:04 SWDEV-77682 - Wave Limiter: Add __attribute__((amd_hint_waves_per_simd(n))) to FE for setting waves/simd hint per kernel. 0 for adaptive wave limitting. 1~10 for fixed waves/simd. Add query of WavesPerSimdHint metadata to compiler lib. HSAI path shouls use aclQueryInfo RT_WAVES_PER_SIMD_HINT to get the waves/simd hint value. This should provide a flexible workaround for bug SWDEV-56552 [CQE OCL][PERF][LNX][QR][G] 19% Perf drop is observed with chunkBp kernel in Carrizo. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/clang/include/clang/Basic/Attr.td#9 edit ... //depot/stg/opencl/drivers/opencl/compiler/clang/lib/CodeGen/CodeGenFunction.cpp#16 edit ... //depot/stg/opencl/drivers/opencl/compiler/clang/lib/Sema/SemaDeclAttr.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/compiler/clc/src/e2lModule.cpp#95 edit ... //depot/stg/opencl/drivers/opencl/compiler/clc/src/e2lModule.h#44 edit ... //depot/stg/opencl/drivers/opencl/compiler/clc/src/oclEntry.cpp#49 edit ... //depot/stg/opencl/drivers/opencl/compiler/clc/src/oclMeta.cpp#32 edit ... //depot/stg/opencl/drivers/opencl/compiler/clc/src/oclMeta.h#32 edit ... //depot/stg/opencl/drivers/opencl/compiler/edg/src/amd_ocl_attribute.c#26 edit ... //depot/stg/opencl/drivers/opencl/compiler/edg/src/attribute.c#29 edit ... //depot/stg/opencl/drivers/opencl/compiler/edg/src/err_codes.h#42 edit ... //depot/stg/opencl/drivers/opencl/compiler/edg/src/err_data.h#56 edit ... //depot/stg/opencl/drivers/opencl/compiler/edg/src/il_def.h#57 edit ... //depot/stg/opencl/drivers/opencl/compiler/edg/src/il_display.c#25 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#77 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDInterface.h#3 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDParser.l#4 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/AMDILMDTypes.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/MDParser/lex.yy.cpp#5 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/metadata.cpp#9 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclEnums.h#23 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclStructs.h#18 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/Transforms/IPO/AMDKernelPerfHint.h#4 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/HSAIL/HSAILKernelManager.cpp#37 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/AMDKernelPerfHint.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm32/include/llvm/Transforms/IPO/AMDKernelPerfHint.h#3 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Target/AMDIL/AMDILKernelManager.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Transforms/IPO/AMDKernelPerfHint.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/src/llc/opt/wave_limiter/explicit.cl#1 add ... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/llc_opt.tlst#57 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLAssumptionCheck.cpp#44 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLEnumCheck.cpp#48 edit --- rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp | 11 +++++++++++ rocclr/compiler/lib/include/v0_8/aclEnums.h | 3 ++- rocclr/compiler/lib/include/v0_8/aclStructs.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index 95139446ef..3c206d6bea 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -2814,6 +2814,17 @@ if_aclQueryInfo(aclCompiler *cl, } break; } + case RT_WAVES_PER_SIMD_HINT: { + size_t waves_per_simd_hint_size = sizeof(md->wavesPerSimdHint); + if (!ptr) { + *size = waves_per_simd_hint_size; + success = true; + } else if (*size >= waves_per_simd_hint_size) { + memcpy(ptr, &md->wavesPerSimdHint, waves_per_simd_hint_size); + success = true; + } + break; + } } return (success) ? ACL_SUCCESS : ACL_ERROR; } diff --git a/rocclr/compiler/lib/include/v0_8/aclEnums.h b/rocclr/compiler/lib/include/v0_8/aclEnums.h index 55babaf18b..25264ada80 100644 --- a/rocclr/compiler/lib/include/v0_8/aclEnums.h +++ b/rocclr/compiler/lib/include/v0_8/aclEnums.h @@ -217,7 +217,8 @@ typedef enum _rt_query_types_enum_0_8 { RT_CONTAINS_SPIR = 21, RT_NUM_KERNEL_HIDDEN_ARGS = 22, RT_CONTAINS_SPIRV = 23, - RT_LAST_TYPE = 24 + RT_WAVES_PER_SIMD_HINT = 24, + RT_LAST_TYPE = 25 } aclQueryType_0_8; //! An enumeration for the various GPU capabilities diff --git a/rocclr/compiler/lib/include/v0_8/aclStructs.h b/rocclr/compiler/lib/include/v0_8/aclStructs.h index 49bbd8e68d..0e648669b9 100644 --- a/rocclr/compiler/lib/include/v0_8/aclStructs.h +++ b/rocclr/compiler/lib/include/v0_8/aclStructs.h @@ -120,6 +120,7 @@ typedef struct _acl_metadata_0_8 { bool enqueue_kernel; // RT_DEVICE_ENQUEUE uint32_t kernel_index; // RT_KERNEL_INDEX uint32_t numHiddenKernelArgs; // RT_NUM_KERNEL_HIDDEN_ARGS + uint32_t wavesPerSimdHint; // RT_WAVES_PER_SIMD_HINT } aclMetadata_0_8; //! An structure that holds information on the capabilities of the bif device.