diff --git a/runtime/enable_gens.cmake b/runtime/enable_gens.cmake index df64500d97..9655a2d5e4 100644 --- a/runtime/enable_gens.cmake +++ b/runtime/enable_gens.cmake @@ -48,7 +48,6 @@ set(RUNTIME_SRCS_GENX_CPP_BASE command_stream_receiver_hw device_queue experimental_command_buffer - flat_batch_buffer_helper_hw gpgpu_walker hw_helper hw_info diff --git a/runtime/gen10/flat_batch_buffer_helper_hw_gen10.cpp b/runtime/gen10/flat_batch_buffer_helper_hw_gen10.cpp deleted file mode 100644 index d87f530b47..0000000000 --- a/runtime/gen10/flat_batch_buffer_helper_hw_gen10.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017 - 2018, Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "hw_cmds.h" -#include "runtime/helpers/flat_batch_buffer_helper_hw.inl" - -namespace OCLRT { - -typedef CNLFamily Family; - -template <> -void FlatBatchBufferHelperHw::sdiSetAddress(typename Family::MI_STORE_DATA_IMM *sdiCommand, uint64_t address) { - sdiCommand->setAddressGraphicsaddress472(address); -} - -template <> -void FlatBatchBufferHelperHw::sdiSetStoreQword(typename Family::MI_STORE_DATA_IMM *sdiCommand, bool setQword) { - sdiCommand->setStoreQword(setQword); -} - -template class FlatBatchBufferHelperHw; -} // namespace OCLRT diff --git a/runtime/gen10/hw_cmds_generated.h b/runtime/gen10/hw_cmds_generated.h index 379e542404..932ecedef5 100644 --- a/runtime/gen10/hw_cmds_generated.h +++ b/runtime/gen10/hw_cmds_generated.h @@ -1586,107 +1586,7 @@ typedef struct tagMI_NOOP { } } MI_NOOP; STATIC_ASSERT(4 == sizeof(MI_NOOP)); -typedef struct tagMI_STORE_DATA_IMM { - union tagTheStructure { - struct tagCommon { - uint32_t DwordLength : BITFIELD_RANGE(0, 9); - uint32_t Reserved_10 : BITFIELD_RANGE(10, 20); - uint32_t StoreQword : BITFIELD_RANGE(21, 21); - uint32_t UseGlobalGtt : BITFIELD_RANGE(22, 22); - uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28); - uint32_t CommandType : BITFIELD_RANGE(29, 31); - uint64_t CoreModeEnable : BITFIELD_RANGE(0, 0); - uint64_t Reserved_33 : BITFIELD_RANGE(1, 1); - uint64_t Address_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47); - uint64_t Address_Reserved : BITFIELD_RANGE(48, 63); - uint32_t DataDword0; - uint32_t DataDword1; - } Common; - uint32_t RawData[5]; - } TheStructure; - typedef enum tagDWORD_LENGTH { - DWORD_LENGTH_STORE_DWORD = 0x2, - DWORD_LENGTH_STORE_QWORD = 0x3, - } DWORD_LENGTH; - typedef enum tagMI_COMMAND_OPCODE { - MI_COMMAND_OPCODE_MI_STORE_DATA_IMM = 0x20, - } MI_COMMAND_OPCODE; - typedef enum tagCOMMAND_TYPE { - COMMAND_TYPE_MI_COMMAND = 0x0, - } COMMAND_TYPE; - inline void init(void) { - memset(&TheStructure, 0, sizeof(TheStructure)); - TheStructure.Common.DwordLength = DWORD_LENGTH_STORE_DWORD; - TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_STORE_DATA_IMM; - TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND; - } - static tagMI_STORE_DATA_IMM sInit(void) { - MI_STORE_DATA_IMM state; - state.init(); - return state; - } - inline uint32_t &getRawData(const uint32_t index) { - DEBUG_BREAK_IF(index >= 5); - return TheStructure.RawData[index]; - } - inline void setDwordLength(const DWORD_LENGTH value) { - TheStructure.Common.DwordLength = value; - } - inline DWORD_LENGTH getDwordLength(void) const { - return static_cast(TheStructure.Common.DwordLength); - } - inline void setStoreQword(const bool value) { - TheStructure.Common.StoreQword = value; - } - inline bool getStoreQword(void) const { - return (TheStructure.Common.StoreQword); - } - inline void setUseGlobalGtt(const bool value) { - TheStructure.Common.UseGlobalGtt = value; - } - inline bool getUseGlobalGtt(void) const { - return (TheStructure.Common.UseGlobalGtt); - } - inline void setCoreModeEnable(const uint64_t value) { - TheStructure.Common.CoreModeEnable = value; - } - inline uint64_t getCoreModeEnable(void) const { - return (TheStructure.Common.CoreModeEnable); - } - typedef enum tagADDRESS_GRAPHICSADDRESS47_2 { - ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2, - ADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4, - } ADDRESS_GRAPHICSADDRESS47_2; - inline void setAddressGraphicsaddress472(const uint64_t value) { - TheStructure.Common.Address_Graphicsaddress47_2 = value >> ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT; - } - inline uint64_t getAddressGraphicsaddress472(void) const { - return (TheStructure.Common.Address_Graphicsaddress47_2 << ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT); - } - typedef enum tagADDRESS_RESERVED { - ADDRESS_RESERVED_BIT_SHIFT = 0x2, - ADDRESS_RESERVED_ALIGN_SIZE = 0x4, - } ADDRESS_RESERVED; - inline void setAddressReserved(const uint64_t value) { - TheStructure.Common.Address_Reserved = value >> ADDRESS_RESERVED_BIT_SHIFT; - } - inline uint64_t getAddressReserved(void) const { - return (TheStructure.Common.Address_Reserved << ADDRESS_RESERVED_BIT_SHIFT); - } - inline void setDataDword0(const uint32_t value) { - TheStructure.Common.DataDword0 = value; - } - inline uint32_t getDataDword0(void) const { - return (TheStructure.Common.DataDword0); - } - inline void setDataDword1(const uint32_t value) { - TheStructure.Common.DataDword1 = value; - } - inline uint32_t getDataDword1(void) const { - return (TheStructure.Common.DataDword1); - } -} MI_STORE_DATA_IMM; -STATIC_ASSERT(20 == sizeof(MI_STORE_DATA_IMM)); + typedef struct tagMI_STORE_REGISTER_MEM { union tagTheStructure { struct tagCommon { diff --git a/runtime/gen10/hw_cmds_generated_patched.h b/runtime/gen10/hw_cmds_generated_patched.h index 8550570809..7709d6f639 100644 --- a/runtime/gen10/hw_cmds_generated_patched.h +++ b/runtime/gen10/hw_cmds_generated_patched.h @@ -515,4 +515,106 @@ typedef struct tagMI_SEMAPHORE_WAIT { } } MI_SEMAPHORE_WAIT; STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT)); + +typedef struct tagMI_STORE_DATA_IMM { + union tagTheStructure { + struct tagCommon { + uint32_t DwordLength : BITFIELD_RANGE(0, 9); + uint32_t Reserved_10 : BITFIELD_RANGE(10, 20); + uint32_t StoreQword : BITFIELD_RANGE(21, 21); + uint32_t UseGlobalGtt : BITFIELD_RANGE(22, 22); + uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28); + uint32_t CommandType : BITFIELD_RANGE(29, 31); + uint64_t CoreModeEnable : BITFIELD_RANGE(0, 0); + uint64_t Reserved_33 : BITFIELD_RANGE(1, 1); + uint64_t Address_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47); + uint64_t Address_Reserved : BITFIELD_RANGE(48, 63); + uint32_t DataDword0; + uint32_t DataDword1; + } Common; + uint32_t RawData[5]; + } TheStructure; + typedef enum tagDWORD_LENGTH { + DWORD_LENGTH_STORE_DWORD = 0x2, + DWORD_LENGTH_STORE_QWORD = 0x3, + } DWORD_LENGTH; + typedef enum tagMI_COMMAND_OPCODE { + MI_COMMAND_OPCODE_MI_STORE_DATA_IMM = 0x20, + } MI_COMMAND_OPCODE; + typedef enum tagCOMMAND_TYPE { + COMMAND_TYPE_MI_COMMAND = 0x0, + } COMMAND_TYPE; + inline void init(void) { + memset(&TheStructure, 0, sizeof(TheStructure)); + TheStructure.Common.DwordLength = DWORD_LENGTH_STORE_DWORD; + TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_STORE_DATA_IMM; + TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND; + } + static tagMI_STORE_DATA_IMM sInit(void) { + MI_STORE_DATA_IMM state; + state.init(); + return state; + } + inline uint32_t &getRawData(const uint32_t index) { + DEBUG_BREAK_IF(index >= 5); + return TheStructure.RawData[index]; + } + inline void setDwordLength(const DWORD_LENGTH value) { + TheStructure.Common.DwordLength = value; + } + inline DWORD_LENGTH getDwordLength(void) const { + return static_cast(TheStructure.Common.DwordLength); + } + inline void setStoreQword(const bool value) { + TheStructure.Common.StoreQword = value; + } + inline bool getStoreQword(void) const { + return (TheStructure.Common.StoreQword); + } + inline void setUseGlobalGtt(const bool value) { + TheStructure.Common.UseGlobalGtt = value; + } + inline bool getUseGlobalGtt(void) const { + return (TheStructure.Common.UseGlobalGtt); + } + inline void setCoreModeEnable(const uint64_t value) { + TheStructure.Common.CoreModeEnable = value; + } + inline uint64_t getCoreModeEnable(void) const { + return (TheStructure.Common.CoreModeEnable); + } + typedef enum tagADDRESS_GRAPHICSADDRESS47_2 { + ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2, + ADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4, + } ADDRESS_GRAPHICSADDRESS47_2; + inline void setAddress(const uint64_t value) { + TheStructure.Common.Address_Graphicsaddress47_2 = value >> ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT; + } + inline uint64_t getAddress(void) const { + return (TheStructure.Common.Address_Graphicsaddress47_2 << ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT); + } + typedef enum tagADDRESS_RESERVED { + ADDRESS_RESERVED_BIT_SHIFT = 0x2, + ADDRESS_RESERVED_ALIGN_SIZE = 0x4, + } ADDRESS_RESERVED; + inline void setAddressReserved(const uint64_t value) { + TheStructure.Common.Address_Reserved = value >> ADDRESS_RESERVED_BIT_SHIFT; + } + inline uint64_t getAddressReserved(void) const { + return (TheStructure.Common.Address_Reserved << ADDRESS_RESERVED_BIT_SHIFT); + } + inline void setDataDword0(const uint32_t value) { + TheStructure.Common.DataDword0 = value; + } + inline uint32_t getDataDword0(void) const { + return (TheStructure.Common.DataDword0); + } + inline void setDataDword1(const uint32_t value) { + TheStructure.Common.DataDword1 = value; + } + inline uint32_t getDataDword1(void) const { + return (TheStructure.Common.DataDword1); + } +} MI_STORE_DATA_IMM; +STATIC_ASSERT(20 == sizeof(MI_STORE_DATA_IMM)); #pragma pack() diff --git a/runtime/gen10/hw_helper_gen10.cpp b/runtime/gen10/hw_helper_gen10.cpp index f9b3c88cb6..952c1baeb6 100644 --- a/runtime/gen10/hw_helper_gen10.cpp +++ b/runtime/gen10/hw_helper_gen10.cpp @@ -22,6 +22,7 @@ #include "runtime/helpers/hw_helper.h" #include "runtime/helpers/hw_helper.inl" +#include "runtime/helpers/flat_batch_buffer_helper_hw.inl" namespace OCLRT { typedef CNLFamily Family; @@ -47,4 +48,5 @@ bool HwHelperHw::setupPreemptionRegisters(HardwareInfo *pHwInfo, bool en } template class HwHelperHw; +template class FlatBatchBufferHelperHw; } // namespace OCLRT diff --git a/runtime/gen8/flat_batch_buffer_helper_hw_gen8.cpp b/runtime/gen8/flat_batch_buffer_helper_hw_gen8.cpp deleted file mode 100644 index bcce05e714..0000000000 --- a/runtime/gen8/flat_batch_buffer_helper_hw_gen8.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "hw_cmds.h" -#include "runtime/helpers/flat_batch_buffer_helper_hw.inl" - -namespace OCLRT { - -constexpr uint32_t LOW32_BIT_MASK = 0x0000FFFFFFFFULL; - -typedef BDWFamily Family; - -template <> -void FlatBatchBufferHelperHw::sdiSetAddress(typename Family::MI_STORE_DATA_IMM *sdiCommand, uint64_t address) { - sdiCommand->setAddress(static_cast(address & LOW32_BIT_MASK)); - sdiCommand->setAddressHigh(static_cast(address >> 32)); -} - -template <> -void FlatBatchBufferHelperHw::sdiSetStoreQword(typename Family::MI_STORE_DATA_IMM *sdiCommand, bool setQword) { - sdiCommand->setStoreQword(setQword ? Family::MI_STORE_DATA_IMM::STORE_QWORD_STORE_QWORD : Family::MI_STORE_DATA_IMM::STORE_QWORD_STORE_DWORD); -} - -template class FlatBatchBufferHelperHw; -} // namespace OCLRT diff --git a/runtime/gen8/hw_cmds_generated.h b/runtime/gen8/hw_cmds_generated.h index fc7a35edb9..299b3b1284 100644 --- a/runtime/gen8/hw_cmds_generated.h +++ b/runtime/gen8/hw_cmds_generated.h @@ -1523,107 +1523,7 @@ typedef struct tagMI_NOOP { } } MI_NOOP; STATIC_ASSERT(4 == sizeof(MI_NOOP)); -typedef struct tagMI_STORE_DATA_IMM { - union tagTheStructure { - struct tagCommon { - uint32_t DwordLength : BITFIELD_RANGE(0, 9); - uint32_t Reserved_10 : BITFIELD_RANGE(10, 20); - uint32_t StoreQword : BITFIELD_RANGE(21, 21); - uint32_t UseGlobalGtt : BITFIELD_RANGE(22, 22); - uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28); - uint32_t CommandType : BITFIELD_RANGE(29, 31); - uint32_t Reserved_32 : BITFIELD_RANGE(0, 1); - uint32_t Address : BITFIELD_RANGE(2, 31); - uint32_t AddressHigh : BITFIELD_RANGE(0, 15); - uint32_t Reserved_80 : BITFIELD_RANGE(16, 31); - uint32_t DataDword0; - uint32_t DataDword1; - } Common; - uint32_t RawData[5]; - } TheStructure; - typedef enum tagDWORD_LENGTH { - DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x0, - } DWORD_LENGTH; - typedef enum tagSTORE_QWORD { - STORE_QWORD_STORE_DWORD = 0x0, - STORE_QWORD_STORE_QWORD = 0x1, - } STORE_QWORD; - typedef enum tagMI_COMMAND_OPCODE { - MI_COMMAND_OPCODE_MI_STORE_DATA_IMM = 0x20, - } MI_COMMAND_OPCODE; - typedef enum tagCOMMAND_TYPE { - COMMAND_TYPE_MI_COMMAND = 0x0, - } COMMAND_TYPE; - typedef enum tagPATCH_CONSTANTS { - ADDRESS_BYTEOFFSET = 0x4, - ADDRESS_INDEX = 0x1, - ADDRESSHIGH_BYTEOFFSET = 0x8, - ADDRESSHIGH_INDEX = 0x2, - } PATCH_CONSTANTS; - inline void init(void) { - memset(&TheStructure, 0, sizeof(TheStructure)); - TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1; - TheStructure.Common.StoreQword = STORE_QWORD_STORE_DWORD; - TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_STORE_DATA_IMM; - TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND; - } - static tagMI_STORE_DATA_IMM sInit(void) { - MI_STORE_DATA_IMM state; - state.init(); - return state; - } - inline uint32_t &getRawData(const uint32_t index) { - DEBUG_BREAK_IF(index >= 5); - return TheStructure.RawData[index]; - } - inline void setDwordLength(const DWORD_LENGTH value) { - TheStructure.Common.DwordLength = value; - } - inline DWORD_LENGTH getDwordLength(void) const { - return static_cast(TheStructure.Common.DwordLength); - } - inline void setStoreQword(const STORE_QWORD value) { - TheStructure.Common.StoreQword = value; - } - inline STORE_QWORD getStoreQword(void) const { - return static_cast(TheStructure.Common.StoreQword); - } - inline void setUseGlobalGtt(const uint32_t value) { - TheStructure.Common.UseGlobalGtt = value; - } - inline uint32_t getUseGlobalGtt(void) const { - return (TheStructure.Common.UseGlobalGtt); - } - typedef enum tagADDRESS { - ADDRESS_BIT_SHIFT = 0x2, - ADDRESS_ALIGN_SIZE = 0x4, - } ADDRESS; - inline void setAddress(const uint32_t value) { - TheStructure.Common.Address = value >> ADDRESS_BIT_SHIFT; - } - inline uint32_t getAddress(void) const { - return (TheStructure.Common.Address << ADDRESS_BIT_SHIFT); - } - inline void setAddressHigh(const uint32_t value) { - TheStructure.Common.AddressHigh = value; - } - inline uint32_t getAddressHigh(void) const { - return (TheStructure.Common.AddressHigh); - } - inline void setDataDword0(const uint32_t value) { - TheStructure.Common.DataDword0 = value; - } - inline uint32_t getDataDword0(void) const { - return (TheStructure.Common.DataDword0); - } - inline void setDataDword1(const uint32_t value) { - TheStructure.Common.DataDword1 = value; - } - inline uint32_t getDataDword1(void) const { - return (TheStructure.Common.DataDword1); - } -} MI_STORE_DATA_IMM; -STATIC_ASSERT(20 == sizeof(MI_STORE_DATA_IMM)); + typedef struct tagMI_STORE_REGISTER_MEM { union tagTheStructure { struct tagCommon { diff --git a/runtime/gen8/hw_cmds_generated_patched.h b/runtime/gen8/hw_cmds_generated_patched.h index 3a6436decc..3a472b85a1 100644 --- a/runtime/gen8/hw_cmds_generated_patched.h +++ b/runtime/gen8/hw_cmds_generated_patched.h @@ -398,4 +398,108 @@ typedef struct tagMI_SEMAPHORE_WAIT { } } MI_SEMAPHORE_WAIT; STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT)); + +typedef struct tagMI_STORE_DATA_IMM { + union tagTheStructure { + struct tagCommon { + uint32_t DwordLength : BITFIELD_RANGE(0, 9); + uint32_t Reserved_10 : BITFIELD_RANGE(10, 20); + uint32_t StoreQword : BITFIELD_RANGE(21, 21); + uint32_t UseGlobalGtt : BITFIELD_RANGE(22, 22); + uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28); + uint32_t CommandType : BITFIELD_RANGE(29, 31); + uint32_t Reserved_32 : BITFIELD_RANGE(0, 1); + uint32_t Address : BITFIELD_RANGE(2, 31); + uint32_t AddressHigh : BITFIELD_RANGE(0, 15); + uint32_t Reserved_80 : BITFIELD_RANGE(16, 31); + uint32_t DataDword0; + uint32_t DataDword1; + } Common; + uint32_t RawData[5]; + } TheStructure; + typedef enum tagDWORD_LENGTH { + DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x0, + } DWORD_LENGTH; + typedef enum tagMI_COMMAND_OPCODE { + MI_COMMAND_OPCODE_MI_STORE_DATA_IMM = 0x20, + } MI_COMMAND_OPCODE; + typedef enum tagCOMMAND_TYPE { + COMMAND_TYPE_MI_COMMAND = 0x0, + } COMMAND_TYPE; + typedef enum tagPATCH_CONSTANTS { + ADDRESS_BYTEOFFSET = 0x4, + ADDRESS_INDEX = 0x1, + ADDRESSHIGH_BYTEOFFSET = 0x8, + ADDRESSHIGH_INDEX = 0x2, + } PATCH_CONSTANTS; + inline void init(void) { + memset(&TheStructure, 0, sizeof(TheStructure)); + TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1; + TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_STORE_DATA_IMM; + TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND; + } + static tagMI_STORE_DATA_IMM sInit(void) { + MI_STORE_DATA_IMM state; + state.init(); + return state; + } + inline uint32_t &getRawData(const uint32_t index) { + DEBUG_BREAK_IF(index >= 5); + return TheStructure.RawData[index]; + } + inline void setDwordLength(const DWORD_LENGTH value) { + TheStructure.Common.DwordLength = value; + } + inline DWORD_LENGTH getDwordLength(void) const { + return static_cast(TheStructure.Common.DwordLength); + } + inline void setStoreQword(const bool value) { + TheStructure.Common.StoreQword = value; + } + inline bool getStoreQword(void) const { + return TheStructure.Common.StoreQword; + } + inline void setUseGlobalGtt(const uint32_t value) { + TheStructure.Common.UseGlobalGtt = value; + } + inline uint32_t getUseGlobalGtt(void) const { + return (TheStructure.Common.UseGlobalGtt); + } + typedef enum tagADDRESS { + ADDRESS_BIT_SHIFT = 0x2, + ADDRESS_ALIGN_SIZE = 0x4, + } ADDRESS; + inline void setAddress(const uint64_t value) { + setAddressLow(static_cast(value & 0x0000FFFFFFFFULL)); + setAddressHigh(static_cast(value >> 32)); + } + inline uint64_t getAddress(void) const { + return (static_cast(getAddressHigh()) << 32) | static_cast(getAddressLow()); + } + inline void setAddressLow(const uint32_t value) { + TheStructure.Common.Address = value >> ADDRESS_BIT_SHIFT; + } + inline uint32_t getAddressLow(void) const { + return (TheStructure.Common.Address << ADDRESS_BIT_SHIFT); + } + inline void setAddressHigh(const uint32_t value) { + TheStructure.Common.AddressHigh = value; + } + inline uint32_t getAddressHigh(void) const { + return (TheStructure.Common.AddressHigh); + } + inline void setDataDword0(const uint32_t value) { + TheStructure.Common.DataDword0 = value; + } + inline uint32_t getDataDword0(void) const { + return (TheStructure.Common.DataDword0); + } + inline void setDataDword1(const uint32_t value) { + TheStructure.Common.DataDword1 = value; + } + inline uint32_t getDataDword1(void) const { + return (TheStructure.Common.DataDword1); + } +} MI_STORE_DATA_IMM; +STATIC_ASSERT(20 == sizeof(MI_STORE_DATA_IMM)); #pragma pack() diff --git a/runtime/gen8/hw_helper_gen8.cpp b/runtime/gen8/hw_helper_gen8.cpp index 85704fb12a..f43993b3a6 100644 --- a/runtime/gen8/hw_helper_gen8.cpp +++ b/runtime/gen8/hw_helper_gen8.cpp @@ -22,6 +22,7 @@ #include "runtime/helpers/hw_helper.h" #include "runtime/helpers/hw_helper.inl" +#include "runtime/helpers/flat_batch_buffer_helper_hw.inl" #include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -46,4 +47,5 @@ void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps, c } template class HwHelperHw; +template class FlatBatchBufferHelperHw; } // namespace OCLRT diff --git a/runtime/gen9/flat_batch_buffer_helper_hw_gen9.cpp b/runtime/gen9/flat_batch_buffer_helper_hw_gen9.cpp deleted file mode 100644 index 9d6c15557b..0000000000 --- a/runtime/gen9/flat_batch_buffer_helper_hw_gen9.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017 - 2018, Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "hw_cmds.h" -#include "runtime/helpers/flat_batch_buffer_helper_hw.inl" - -namespace OCLRT { - -typedef SKLFamily Family; - -template <> -void FlatBatchBufferHelperHw::sdiSetAddress(typename Family::MI_STORE_DATA_IMM *sdiCommand, uint64_t address) { - sdiCommand->setAddressGraphicsaddress472(address); -} - -template <> -void FlatBatchBufferHelperHw::sdiSetStoreQword(typename Family::MI_STORE_DATA_IMM *sdiCommand, bool setQword) { - sdiCommand->setStoreQword(setQword); -} - -template class FlatBatchBufferHelperHw; -} // namespace OCLRT diff --git a/runtime/gen9/hw_cmds_generated.h b/runtime/gen9/hw_cmds_generated.h index 197aa18640..a515d6e24a 100644 --- a/runtime/gen9/hw_cmds_generated.h +++ b/runtime/gen9/hw_cmds_generated.h @@ -1527,107 +1527,7 @@ typedef struct tagMI_NOOP { } } MI_NOOP; STATIC_ASSERT(4 == sizeof(MI_NOOP)); -typedef struct tagMI_STORE_DATA_IMM { - union tagTheStructure { - struct tagCommon { - uint32_t DwordLength : BITFIELD_RANGE(0, 9); - uint32_t Reserved_10 : BITFIELD_RANGE(10, 20); - uint32_t StoreQword : BITFIELD_RANGE(21, 21); - uint32_t UseGlobalGtt : BITFIELD_RANGE(22, 22); - uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28); - uint32_t CommandType : BITFIELD_RANGE(29, 31); - uint64_t CoreModeEnable : BITFIELD_RANGE(0, 0); - uint64_t Reserved_33 : BITFIELD_RANGE(1, 1); - uint64_t Address_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47); - uint64_t Address_Reserved : BITFIELD_RANGE(48, 63); - uint32_t DataDword0; - uint32_t DataDword1; - } Common; - uint32_t RawData[5]; - } TheStructure; - typedef enum tagDWORD_LENGTH { - DWORD_LENGTH_STORE_DWORD = 0x2, - DWORD_LENGTH_STORE_QWORD = 0x3, - } DWORD_LENGTH; - typedef enum tagMI_COMMAND_OPCODE { - MI_COMMAND_OPCODE_MI_STORE_DATA_IMM = 0x20, - } MI_COMMAND_OPCODE; - typedef enum tagCOMMAND_TYPE { - COMMAND_TYPE_MI_COMMAND = 0x0, - } COMMAND_TYPE; - inline void init(void) { - memset(&TheStructure, 0, sizeof(TheStructure)); - TheStructure.Common.DwordLength = DWORD_LENGTH_STORE_DWORD; - TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_STORE_DATA_IMM; - TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND; - } - static tagMI_STORE_DATA_IMM sInit(void) { - MI_STORE_DATA_IMM state; - state.init(); - return state; - } - inline uint32_t &getRawData(const uint32_t index) { - DEBUG_BREAK_IF(index >= 5); - return TheStructure.RawData[index]; - } - inline void setDwordLength(const DWORD_LENGTH value) { - TheStructure.Common.DwordLength = value; - } - inline DWORD_LENGTH getDwordLength(void) const { - return static_cast(TheStructure.Common.DwordLength); - } - inline void setStoreQword(const bool value) { - TheStructure.Common.StoreQword = value; - } - inline bool getStoreQword(void) const { - return (TheStructure.Common.StoreQword); - } - inline void setUseGlobalGtt(const bool value) { - TheStructure.Common.UseGlobalGtt = value; - } - inline bool getUseGlobalGtt(void) const { - return (TheStructure.Common.UseGlobalGtt); - } - inline void setCoreModeEnable(const uint64_t value) { - TheStructure.Common.CoreModeEnable = value; - } - inline uint64_t getCoreModeEnable(void) const { - return (TheStructure.Common.CoreModeEnable); - } - typedef enum tagADDRESS_GRAPHICSADDRESS47_2 { - ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2, - ADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4, - } ADDRESS_GRAPHICSADDRESS47_2; - inline void setAddressGraphicsaddress472(const uint64_t value) { - TheStructure.Common.Address_Graphicsaddress47_2 = value >> ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT; - } - inline uint64_t getAddressGraphicsaddress472(void) const { - return (TheStructure.Common.Address_Graphicsaddress47_2 << ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT); - } - typedef enum tagADDRESS_RESERVED { - ADDRESS_RESERVED_BIT_SHIFT = 0x2, - ADDRESS_RESERVED_ALIGN_SIZE = 0x4, - } ADDRESS_RESERVED; - inline void setAddressReserved(const uint64_t value) { - TheStructure.Common.Address_Reserved = value >> ADDRESS_RESERVED_BIT_SHIFT; - } - inline uint64_t getAddressReserved(void) const { - return (TheStructure.Common.Address_Reserved << ADDRESS_RESERVED_BIT_SHIFT); - } - inline void setDataDword0(const uint32_t value) { - TheStructure.Common.DataDword0 = value; - } - inline uint32_t getDataDword0(void) const { - return (TheStructure.Common.DataDword0); - } - inline void setDataDword1(const uint32_t value) { - TheStructure.Common.DataDword1 = value; - } - inline uint32_t getDataDword1(void) const { - return (TheStructure.Common.DataDword1); - } -} MI_STORE_DATA_IMM; -STATIC_ASSERT(20 == sizeof(MI_STORE_DATA_IMM)); + typedef struct tagMI_STORE_REGISTER_MEM { union tagTheStructure { struct tagCommon { diff --git a/runtime/gen9/hw_cmds_generated_patched.h b/runtime/gen9/hw_cmds_generated_patched.h index 4da2e9ca00..956103841f 100644 --- a/runtime/gen9/hw_cmds_generated_patched.h +++ b/runtime/gen9/hw_cmds_generated_patched.h @@ -489,4 +489,105 @@ typedef struct tagMI_SEMAPHORE_WAIT { } MI_SEMAPHORE_WAIT; STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT)); +typedef struct tagMI_STORE_DATA_IMM { + union tagTheStructure { + struct tagCommon { + uint32_t DwordLength : BITFIELD_RANGE(0, 9); + uint32_t Reserved_10 : BITFIELD_RANGE(10, 20); + uint32_t StoreQword : BITFIELD_RANGE(21, 21); + uint32_t UseGlobalGtt : BITFIELD_RANGE(22, 22); + uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28); + uint32_t CommandType : BITFIELD_RANGE(29, 31); + uint64_t CoreModeEnable : BITFIELD_RANGE(0, 0); + uint64_t Reserved_33 : BITFIELD_RANGE(1, 1); + uint64_t Address_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47); + uint64_t Address_Reserved : BITFIELD_RANGE(48, 63); + uint32_t DataDword0; + uint32_t DataDword1; + } Common; + uint32_t RawData[5]; + } TheStructure; + typedef enum tagDWORD_LENGTH { + DWORD_LENGTH_STORE_DWORD = 0x2, + DWORD_LENGTH_STORE_QWORD = 0x3, + } DWORD_LENGTH; + typedef enum tagMI_COMMAND_OPCODE { + MI_COMMAND_OPCODE_MI_STORE_DATA_IMM = 0x20, + } MI_COMMAND_OPCODE; + typedef enum tagCOMMAND_TYPE { + COMMAND_TYPE_MI_COMMAND = 0x0, + } COMMAND_TYPE; + inline void init(void) { + memset(&TheStructure, 0, sizeof(TheStructure)); + TheStructure.Common.DwordLength = DWORD_LENGTH_STORE_DWORD; + TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_STORE_DATA_IMM; + TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND; + } + static tagMI_STORE_DATA_IMM sInit(void) { + MI_STORE_DATA_IMM state; + state.init(); + return state; + } + inline uint32_t &getRawData(const uint32_t index) { + DEBUG_BREAK_IF(index >= 5); + return TheStructure.RawData[index]; + } + inline void setDwordLength(const DWORD_LENGTH value) { + TheStructure.Common.DwordLength = value; + } + inline DWORD_LENGTH getDwordLength(void) const { + return static_cast(TheStructure.Common.DwordLength); + } + inline void setStoreQword(const bool value) { + TheStructure.Common.StoreQword = value; + } + inline bool getStoreQword(void) const { + return (TheStructure.Common.StoreQword); + } + inline void setUseGlobalGtt(const bool value) { + TheStructure.Common.UseGlobalGtt = value; + } + inline bool getUseGlobalGtt(void) const { + return (TheStructure.Common.UseGlobalGtt); + } + inline void setCoreModeEnable(const uint64_t value) { + TheStructure.Common.CoreModeEnable = value; + } + inline uint64_t getCoreModeEnable(void) const { + return (TheStructure.Common.CoreModeEnable); + } + typedef enum tagADDRESS_GRAPHICSADDRESS47_2 { + ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2, + ADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4, + } ADDRESS_GRAPHICSADDRESS47_2; + inline void setAddress(const uint64_t value) { + TheStructure.Common.Address_Graphicsaddress47_2 = value >> ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT; + } + inline uint64_t getAddress(void) const { + return (TheStructure.Common.Address_Graphicsaddress47_2 << ADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT); + } + typedef enum tagADDRESS_RESERVED { + ADDRESS_RESERVED_BIT_SHIFT = 0x2, + ADDRESS_RESERVED_ALIGN_SIZE = 0x4, + } ADDRESS_RESERVED; + inline void setAddressReserved(const uint64_t value) { + TheStructure.Common.Address_Reserved = value >> ADDRESS_RESERVED_BIT_SHIFT; + } + inline uint64_t getAddressReserved(void) const { + return (TheStructure.Common.Address_Reserved << ADDRESS_RESERVED_BIT_SHIFT); + } + inline void setDataDword0(const uint32_t value) { + TheStructure.Common.DataDword0 = value; + } + inline uint32_t getDataDword0(void) const { + return (TheStructure.Common.DataDword0); + } + inline void setDataDword1(const uint32_t value) { + TheStructure.Common.DataDword1 = value; + } + inline uint32_t getDataDword1(void) const { + return (TheStructure.Common.DataDword1); + } +} MI_STORE_DATA_IMM; +STATIC_ASSERT(20 == sizeof(MI_STORE_DATA_IMM)); #pragma pack() diff --git a/runtime/gen9/hw_helper_gen9.cpp b/runtime/gen9/hw_helper_gen9.cpp index 2265ded115..dc4a28cb42 100644 --- a/runtime/gen9/hw_helper_gen9.cpp +++ b/runtime/gen9/hw_helper_gen9.cpp @@ -22,6 +22,7 @@ #include "runtime/helpers/hw_helper.h" #include "runtime/helpers/hw_helper.inl" +#include "runtime/helpers/flat_batch_buffer_helper_hw.inl" namespace OCLRT { typedef SKLFamily Family; @@ -46,4 +47,5 @@ SipKernelType HwHelperHw::getSipKernelType(bool debuggingActive) { } template class HwHelperHw; +template class FlatBatchBufferHelperHw; } // namespace OCLRT diff --git a/runtime/helpers/flat_batch_buffer_helper_hw.h b/runtime/helpers/flat_batch_buffer_helper_hw.h index 8199ebe8b6..68b59984e5 100644 --- a/runtime/helpers/flat_batch_buffer_helper_hw.h +++ b/runtime/helpers/flat_batch_buffer_helper_hw.h @@ -33,8 +33,6 @@ class FlatBatchBufferHelperHw : public FlatBatchBufferHelper { GraphicsAllocation *flattenBatchBuffer(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode) override; char *getIndirectPatchCommands(size_t &indirectPatchCommandsSize, std::vector &indirectPatchInfo) override; void removePipeControlData(size_t pipeControlLocationSize, void *pipeControlForNooping) override; - static void sdiSetAddress(typename GfxFamily::MI_STORE_DATA_IMM *sdiCommand, uint64_t address); - static void sdiSetStoreQword(typename GfxFamily::MI_STORE_DATA_IMM *sdiCommand, bool setQword); }; -} // namespace OCLRT \ No newline at end of file +} // namespace OCLRT diff --git a/runtime/helpers/flat_batch_buffer_helper_hw.inl b/runtime/helpers/flat_batch_buffer_helper_hw.inl index 5ad5421901..869fb632b2 100644 --- a/runtime/helpers/flat_batch_buffer_helper_hw.inl +++ b/runtime/helpers/flat_batch_buffer_helper_hw.inl @@ -176,8 +176,8 @@ char *FlatBatchBufferHelperHw::getIndirectPatchCommands(size_t &indir if (patchInfoData.requiresIndirectPatching()) { auto storeDataImmediate = indirectPatchCommandStream.getSpaceForCmd(); storeDataImmediate->init(); - sdiSetAddress(storeDataImmediate, patchInfoData.targetAllocation + patchInfoData.targetAllocationOffset); - sdiSetStoreQword(storeDataImmediate, patchInfoData.patchAddressSize != sizeof(uint32_t)); + storeDataImmediate->setAddress(patchInfoData.targetAllocation + patchInfoData.targetAllocationOffset); + storeDataImmediate->setStoreQword(patchInfoData.patchAddressSize != sizeof(uint32_t)); storeDataImmediate->setDataDword0(static_cast((patchInfoData.sourceAllocation + patchInfoData.sourceAllocationOffset) & 0x0000FFFFFFFFULL)); storeDataImmediate->setDataDword1(static_cast((patchInfoData.sourceAllocation + patchInfoData.sourceAllocationOffset) >> 32)); diff --git a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp index df43191538..d9c89c0952 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp @@ -1700,19 +1700,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddBatc EXPECT_EQ(0xA000u, addr.second); } -HWTEST_F(AubCommandStreamReceiverTests, givenFlatBatchBufferHelperWhenSettingSroreQwordOnSDICommandThenAppropriateBitIsSet) { - typedef typename FamilyType::MI_STORE_DATA_IMM MI_STORE_DATA_IMM; - - std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw(*platformDevices[0], "", true, *pDevice->executionEnvironment)); - - MI_STORE_DATA_IMM cmd; - cmd.init(); - FlatBatchBufferHelperHw::sdiSetStoreQword(&cmd, false); - EXPECT_EQ(0u, static_cast(cmd.getStoreQword())); - FlatBatchBufferHelperHw::sdiSetStoreQword(&cmd, true); - EXPECT_EQ(1u, static_cast(cmd.getStoreQword())); -} - class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryManager { public: GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) override { diff --git a/unit_tests/gen10/cmd_parse_gen10.cpp b/unit_tests/gen10/cmd_parse_gen10.cpp index 68afaefd36..2289682146 100644 --- a/unit_tests/gen10/cmd_parse_gen10.cpp +++ b/unit_tests/gen10/cmd_parse_gen10.cpp @@ -48,6 +48,7 @@ using MI_MATH = GEN10::MI_MATH; using GPGPU_CSR_BASE_ADDRESS = GEN10::GPGPU_CSR_BASE_ADDRESS; using STATE_SIP = GEN10::STATE_SIP; using MI_SEMAPHORE_WAIT = GEN10::MI_SEMAPHORE_WAIT; +using MI_STORE_DATA_IMM = GEN10::MI_STORE_DATA_IMM; // clang-format on template <> @@ -278,6 +279,16 @@ MI_SEMAPHORE_WAIT *genCmdCast(void *buffer) { : nullptr; } +template <> +MI_STORE_DATA_IMM *genCmdCast(void *buffer) { + auto pCmd = reinterpret_cast(buffer); + + return MI_STORE_DATA_IMM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType && + MI_STORE_DATA_IMM::MI_COMMAND_OPCODE_MI_STORE_DATA_IMM == pCmd->TheStructure.Common.MiCommandOpcode + ? pCmd + : nullptr; +} + size_t CnlParse::getCommandLength(void *cmd) { { auto pCmd = genCmdCast(cmd); @@ -384,6 +395,11 @@ size_t CnlParse::getCommandLength(void *cmd) { if (pCmd) return pCmd->TheStructure.Common.DwordLength + 2; } + { + auto pCmd = genCmdCast(cmd); + if (pCmd) + return pCmd->TheStructure.Common.DwordLength + 3; + } return 0; } diff --git a/unit_tests/gen8/cmd_parse_gen8.cpp b/unit_tests/gen8/cmd_parse_gen8.cpp index 89e5d0546b..464db3df86 100644 --- a/unit_tests/gen8/cmd_parse_gen8.cpp +++ b/unit_tests/gen8/cmd_parse_gen8.cpp @@ -46,6 +46,7 @@ using MI_REPORT_PERF_COUNT = GEN8::MI_REPORT_PERF_COUNT; using MI_MATH = GEN8::MI_MATH; using MI_LOAD_REGISTER_REG = GEN8::MI_LOAD_REGISTER_REG; using MI_SEMAPHORE_WAIT = GEN8::MI_SEMAPHORE_WAIT; +using MI_STORE_DATA_IMM = GEN8::MI_STORE_DATA_IMM; // clang-format on template <> @@ -252,6 +253,16 @@ MI_SEMAPHORE_WAIT *genCmdCast(void *buffer) { : nullptr; } +template <> +MI_STORE_DATA_IMM *genCmdCast(void *buffer) { + auto pCmd = reinterpret_cast(buffer); + + return MI_STORE_DATA_IMM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType && + MI_STORE_DATA_IMM::MI_COMMAND_OPCODE_MI_STORE_DATA_IMM == pCmd->TheStructure.Common.MiCommandOpcode + ? pCmd + : nullptr; +} + size_t BdwParse::getCommandLength(void *cmd) { { auto pCmd = genCmdCast(cmd); @@ -348,6 +359,11 @@ size_t BdwParse::getCommandLength(void *cmd) { if (pCmd) return pCmd->TheStructure.Common.DwordLength + 2; } + { + auto pCmd = genCmdCast(cmd); + if (pCmd) + return pCmd->TheStructure.Common.DwordLength + 3; + } return 0; } diff --git a/unit_tests/gen9/cmd_parse_gen9.cpp b/unit_tests/gen9/cmd_parse_gen9.cpp index e3a28032bd..e62d6b2988 100644 --- a/unit_tests/gen9/cmd_parse_gen9.cpp +++ b/unit_tests/gen9/cmd_parse_gen9.cpp @@ -48,6 +48,7 @@ using MI_LOAD_REGISTER_REG = GEN9::MI_LOAD_REGISTER_REG; using GPGPU_CSR_BASE_ADDRESS = GEN9::GPGPU_CSR_BASE_ADDRESS; using STATE_SIP = GEN9::STATE_SIP; using MI_SEMAPHORE_WAIT = GEN9::MI_SEMAPHORE_WAIT; +using MI_STORE_DATA_IMM = GEN9::MI_STORE_DATA_IMM; // clang-format on template <> @@ -278,6 +279,16 @@ MI_SEMAPHORE_WAIT *genCmdCast(void *buffer) { : nullptr; } +template <> +MI_STORE_DATA_IMM *genCmdCast(void *buffer) { + auto pCmd = reinterpret_cast(buffer); + + return MI_STORE_DATA_IMM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType && + MI_STORE_DATA_IMM::MI_COMMAND_OPCODE_MI_STORE_DATA_IMM == pCmd->TheStructure.Common.MiCommandOpcode + ? pCmd + : nullptr; +} + size_t SklParse::getCommandLength(void *cmd) { { auto pCmd = genCmdCast(cmd); @@ -384,6 +395,11 @@ size_t SklParse::getCommandLength(void *cmd) { if (pCmd) return pCmd->TheStructure.Common.DwordLength + 2; } + { + auto pCmd = genCmdCast(cmd); + if (pCmd) + return pCmd->TheStructure.Common.DwordLength + 3; + } return 0; }