From 1cd8d200d8705c2d92d8ac1eee793533e56f894c Mon Sep 17 00:00:00 2001 From: Tim Bauer Date: Thu, 27 Jul 2023 08:54:29 +0000 Subject: [PATCH] (NFC)LSC API simplification Removes nearly all overloads for LSC functions. SurfaceIndex emulates adding for BSS/SS (NFC) No functional changes. --- IGC/Compiler/CISACodeGen/CISABuilder.cpp | 33 +++-- .../lib/GenXCodeGen/GenXCisaBuilder.cpp | 10 +- visa/VISAKernel.h | 62 ++++------ visa/VISAKernelImpl.cpp | 115 +++++++----------- visa/include/VISABuilderAPIDefinition.h | 81 +++++------- 5 files changed, 123 insertions(+), 178 deletions(-) diff --git a/IGC/Compiler/CISACodeGen/CISABuilder.cpp b/IGC/Compiler/CISACodeGen/CISABuilder.cpp index 40aa5a2546cd..3bd741433010 100644 --- a/IGC/Compiler/CISACodeGen/CISABuilder.cpp +++ b/IGC/Compiler/CISACodeGen/CISABuilder.cpp @@ -2628,10 +2628,11 @@ namespace IGC LSC_ADDR_SIZE_32b, dataShape, GetVISALSCSurfaceOpnd(resource.m_surfaceType, resource.m_resource), + 0, dstVar, - dummyZero, - nullptr, - nullptr, + dummyZero, 0, + nullptr, 0, + nullptr, 0, nullptr, nullptr, nullptr)); @@ -8236,6 +8237,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + 0, dstOpnd, addressOpnd)); @@ -8250,12 +8252,14 @@ namespace IGC addr2, dataShape2, globalOffsetOpnd2, + 0, dstOpnd2, addressOpnd2)); return; } + unsigned surfaceIndex = 0x0; V(vKernel->AppendVISALscUntypedLoad( subOp, lscSfid, @@ -8266,6 +8270,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + surfaceIndex, dstOpnd, addressOpnd)); } @@ -8371,6 +8376,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + 0, addressOpnd, src1Opnd)); @@ -8385,6 +8391,7 @@ namespace IGC addr2, dataShape2, globalOffsetOpnd2, + 0, addressOpnd2, src1Opnd2)); @@ -8400,6 +8407,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + 0, addressOpnd, src1Opnd)); } @@ -8453,6 +8461,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + 0, dstOpnd, addressOpnd)); } @@ -8504,6 +8513,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + 0, addressOpnd, src1Opnd)); } @@ -8652,6 +8662,7 @@ namespace IGC addr, dataShape, globalOffsetOpnd, + 0, dstOpnd, src0AddrOpnd, src0Opnd, @@ -8801,7 +8812,9 @@ namespace IGC VISA_RawOpnd* pUOffset = GetRawSource(pU, m_encoderState.m_srcOperand[0].subVar * getGRFSize()); VISA_RawOpnd* pVOffset = GetRawSource(pV, m_encoderState.m_srcOperand[1].subVar * getGRFSize()); VISA_RawOpnd* pROffset = GetRawSource(pR, m_encoderState.m_srcOperand[2].subVar * getGRFSize()); - VISA_RawOpnd* pLODOffset = GetRawSource(pLOD, m_encoderState.m_srcOperand[3].subVar * getGRFSize()); + + // LoD or whatever indexing is being used + VISA_RawOpnd* pIndex = GetRawSource(pLOD, m_encoderState.m_srcOperand[3].subVar * getGRFSize()); VISA_PredOpnd* predOpnd = GetFlagOperand(m_encoderState.m_flag); IGC_ASSERT(m_encoderState.m_dstOperand.subVar == 0); @@ -8813,6 +8826,9 @@ namespace IGC dataShape.order = LSC_DATA_ORDER_NONTRANSPOSE; dataShape.elems = LSC_GetElementNum(numElems); dataShape.chmask = chMask; + unsigned surfaceIndex = 0; + int uOff = 0, vOff = 0, rOff = 0; + V(vKernel->AppendVISALscTypedInst( subOp, predOpnd, @@ -8823,11 +8839,12 @@ namespace IGC addr_size, dataShape, globalOffsetOpnd, + surfaceIndex, pDst, - pUOffset, - pVOffset, - pROffset, - pLODOffset, + pUOffset, uOff, + pVOffset, vOff, + pROffset, rOff, + pIndex, pSrc, nullptr)); } diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp b/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp index 96278f75d770..07d0d04e7560 100644 --- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp +++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp @@ -4082,9 +4082,10 @@ void GenXKernelBuilder::buildIntrinsic(CallInst *CI, unsigned IntrinID, LSC_DATA_SHAPE DataDesc = {ElementSize, LSC_DATA_ORDER_NONTRANSPOSE, LSC_DATA_ELEMS_1}; + unsigned SurfIdx = 0; CISA_CALL(Kernel->AppendVISALscUntypedAtomic( Opcode, LscSfid, Pred, ExecSize, ExecMask, CacheOpts, AddressDesc, - DataDesc, Base, Dest, Addr, Src1, Src2)); + DataDesc, Base, SurfIdx, Dest, Addr, Src1, Src2)); }; auto CreateLscLoad = [&](VISA_PredOpnd *Pred, VISA_Exec_Size ExecSize, @@ -4114,9 +4115,11 @@ void GenXKernelBuilder::buildIntrinsic(CallInst *CI, unsigned IntrinID, DataDesc.chmask = VectorAttr; } + unsigned SurfIdx = 0; CISA_CALL(Kernel->AppendVISALscUntypedLoad(Opcode, LscSfid, Pred, ExecSize, ExecMask, CacheOpts, AddressDesc, - DataDesc, Base, Dest, Addr)); + DataDesc, Base, SurfIdx, Dest, + Addr)); }; auto CreateLscStore = @@ -4145,9 +4148,10 @@ void GenXKernelBuilder::buildIntrinsic(CallInst *CI, unsigned IntrinID, DataDesc.chmask = VectorAttr; } + unsigned SurfIdx = 0; CISA_CALL(Kernel->AppendVISALscUntypedStore( Opcode, LscSfid, Pred, ExecSize, ExecMask, CacheOpts, AddressDesc, - DataDesc, Base, Addr, Data)); + DataDesc, Base, SurfIdx, Addr, Data)); }; auto CreateLscUntypedBlock2DStateless = diff --git a/visa/VISAKernel.h b/visa/VISAKernel.h index 3dbf6c18742c..ae1509a4fe1c 100644 --- a/visa/VISAKernel.h +++ b/visa/VISAKernel.h @@ -823,44 +823,22 @@ class VISAKernelImpl : public VISAFunction { VISA_SVM_Block_Num numBlocks, VISA_StateOpndHandle *surface, VISA_RawOpnd *address, VISA_RawOpnd *dst) override; - // overloaded functions for untyped instructions with/without surface index - VISA_BUILDER_API int AppendVISALscUntypedLoad( - LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, VISA_RawOpnd *dstData, - VISA_RawOpnd *src0Addr) override; VISA_BUILDER_API int AppendVISALscUntypedLoad( LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dstData, VISA_RawOpnd *src0Addr) override; - VISA_BUILDER_API int AppendVISALscUntypedStore( - LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, VISA_RawOpnd *src0Addr, - VISA_RawOpnd *src1Data) override; VISA_BUILDER_API int AppendVISALscUntypedStore( LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *src0Addr,VISA_RawOpnd *src1Data) override; - VISA_BUILDER_API int AppendVISALscUntypedAtomic( - LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, VISA_RawOpnd *dstReadBack, - VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1AtomOpnd1, - VISA_RawOpnd *src2AtomOpnd2) override; VISA_BUILDER_API int AppendVISALscUntypedAtomic( LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dstReadBack, VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1AtomOpnd1, VISA_RawOpnd *src2AtomOpnd2) override; - VISA_BUILDER_API int AppendVISALscUntypedInst( - LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, VISA_RawOpnd *dst, - VISA_RawOpnd *src0, VISA_RawOpnd *src1, VISA_RawOpnd *src2) override; VISA_BUILDER_API int AppendVISALscUntypedInst( LSC_OP op, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, @@ -884,40 +862,44 @@ class VISAKernelImpl : public VISAFunction { VISA_BUILDER_API int AppendVISALscTypedLoad( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrModel, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dstData, VISA_RawOpnd *Us, VISA_RawOpnd *Vs, - VISA_RawOpnd *Rs, VISA_RawOpnd *LODs) override; + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *dstData, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, VISA_RawOpnd *LODs) override; VISA_BUILDER_API int AppendVISALscTypedStore( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *Us, VISA_RawOpnd *Vs, VISA_RawOpnd *Rs, VISA_RawOpnd *LODs, + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *Us, int uOffset, VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, VISA_RawOpnd *LODs, VISA_RawOpnd *src1Data) override; VISA_BUILDER_API int AppendVISALscTypedAtomic( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dst, VISA_RawOpnd *Us, VISA_RawOpnd *Vs, VISA_RawOpnd *Rs, - VISA_RawOpnd *LODs, VISA_RawOpnd *src1AtomicOpnd1, - VISA_RawOpnd *src2AtomicOpnd2) override; + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *dst, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, + VISA_RawOpnd *LODs, + VISA_RawOpnd *src1AtomicOpnd1, VISA_RawOpnd *src2AtomicOpnd2) override; - VISA_BUILDER_API int AppendVISALscTypedInst( - LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dst, VISA_RawOpnd *coord0s, VISA_RawOpnd *coord1s, - VISA_RawOpnd *coord2s, VISA_RawOpnd *features, VISA_RawOpnd *src1, VISA_RawOpnd *src2) override; VISA_BUILDER_API int AppendVISALscTypedInst( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dst, - VISA_RawOpnd *coord0s, int coord0Offset, - VISA_RawOpnd *coord1s, int coord1Offset, - VISA_RawOpnd *coord2s, int coord2Offset, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, VISA_RawOpnd *features, VISA_RawOpnd *src1, VISA_RawOpnd *src2) override; + VISA_BUILDER_API int AppendVISALscFence(LSC_SFID lscSfid, LSC_FENCE_OP fenceOp, LSC_SCOPE scope) override; diff --git a/visa/VISAKernelImpl.cpp b/visa/VISAKernelImpl.cpp index 11a6faf4099e..6b4b0bcfeacb 100644 --- a/visa/VISAKernelImpl.cpp +++ b/visa/VISAKernelImpl.cpp @@ -7501,65 +7501,41 @@ int VISAKernelImpl::AppendVISAQwordScatterInst( VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedLoad( LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, + LSC_ADDR addr, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dstData, VISA_RawOpnd *src0Addr) { return AppendVISALscUntypedInst(subOpcode, sfid, pred, execSize, emask, - cacheOpts, addr, data, surface, dstData, + cacheOpts, addr, data, + surface, surfaceIndex, dstData, src0Addr, nullptr, nullptr); } -VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedLoad( - LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - unsigned surfaceIndex, VISA_RawOpnd *dstData, VISA_RawOpnd *src0Addr) { - return AppendVISALscUntypedInst(subOpcode, sfid, pred, execSize, emask, - cacheOpts, addr, data, surface, surfaceIndex, - dstData, src0Addr, nullptr, nullptr); -} - VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedStore( LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, + LSC_ADDR addr, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1Data) { return AppendVISALscUntypedInst(subOpcode, sfid, pred, execSize, emask, - cacheOpts, addr, data, surface, nullptr, + cacheOpts, addr, data, + surface, surfaceIndex, nullptr, src0Addr, src1Data, nullptr); } -VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedStore( - LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - unsigned surfaceIndex,VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1Data) { - return AppendVISALscUntypedInst(subOpcode, sfid, pred, execSize, emask, - cacheOpts, addr, data, surface, surfaceIndex, - nullptr, src0Addr, src1Data, nullptr); -} - VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedAtomic( LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, + LSC_ADDR addr, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dstReadBack, VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1AtomOpnd1, VISA_RawOpnd *src2AtomOpnd2) { return AppendVISALscUntypedInst(subOpcode, sfid, pred, execSize, emask, - cacheOpts, addr, data, surface, dstReadBack, + cacheOpts, addr, data, + surface, surfaceIndex, + dstReadBack, src0Addr, src1AtomOpnd1, src2AtomOpnd2); } -VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedAtomic( - LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - unsigned surfaceIndex, VISA_RawOpnd *dstReadBack, VISA_RawOpnd *src0Addr, - VISA_RawOpnd *src1AtomOpnd1, VISA_RawOpnd *src2AtomOpnd2) { - return AppendVISALscUntypedInst(subOpcode, sfid, pred, execSize, emask, - cacheOpts, addr, data, surface, surfaceIndex, - dstReadBack, src0Addr, src1AtomOpnd1, - src2AtomOpnd2); -} static const int LSC_ZERO = 0; #define LSC_CHECK_NULL_VECTOR_OPERAND(X) \ @@ -7581,18 +7557,6 @@ static const int LSC_ZERO = 0; #define LSC_CHECK_NULL_DST(X) LSC_CHECK_NULL_OPND(X, true) #define LSC_CHECK_NULL_SRC(X) LSC_CHECK_NULL_OPND(X, false) -VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedInst( - LSC_OP subOpcode, LSC_SFID lscSfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE dataShape, VISA_VectorOpnd* surface, - VISA_RawOpnd *dstData, VISA_RawOpnd *src0Addr, - VISA_RawOpnd *src1Data, VISA_RawOpnd *src2Data) { - - return AppendVISALscUntypedInst(subOpcode, lscSfid, pred, execSize, emask, cacheOpts, - addr, dataShape, surface, 0 /* default value */, dstData, src0Addr, - src1Data, src2Data); -} - VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedInst( LSC_OP subOpcode, LSC_SFID lscSfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, @@ -7905,50 +7869,53 @@ VISA_BUILDER_API int VISAKernelImpl::AppendVISALscUntypedBlock2DInst( VISA_BUILDER_API int VISAKernelImpl::AppendVISALscTypedLoad( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dstData, VISA_RawOpnd *Us, VISA_RawOpnd *Vs, VISA_RawOpnd *Rs, + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *dstData, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, VISA_RawOpnd *LODs) { return AppendVISALscTypedInst(op, pred, execSize, emask, cacheOpts, addrType, - addrSize, data, surface, dstData, Us, Vs, Rs, + addrSize, data, surface, surfaceIndex, dstData, + Us, uOffset, Vs, vOffset, Rs, rOffset, LODs, nullptr, nullptr); } VISA_BUILDER_API int VISAKernelImpl::AppendVISALscTypedStore( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *Us, VISA_RawOpnd *Vs, VISA_RawOpnd *Rs, VISA_RawOpnd *LODs, + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, + VISA_RawOpnd *LODs, VISA_RawOpnd *src1Data) { return AppendVISALscTypedInst(op, pred, execSize, emask, cacheOpts, addrType, - addrSize, data, surface, nullptr, Us, Vs, Rs, + addrSize, data, surface, surfaceIndex, nullptr, + Us, uOffset, Vs, vOffset, Rs, rOffset, LODs, src1Data, nullptr); } VISA_BUILDER_API int VISAKernelImpl::AppendVISALscTypedAtomic( LSC_OP op, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dstReadBack, VISA_RawOpnd *Us, VISA_RawOpnd *Vs, - VISA_RawOpnd *Rs, VISA_RawOpnd *LODs, VISA_RawOpnd *src1AtomicOpnd1, - VISA_RawOpnd *src2AtomicOpnd2) { + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *dstReadBack, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, + VISA_RawOpnd *LODs, + VISA_RawOpnd *src1AtomicOpnd1, VISA_RawOpnd *src2AtomicOpnd2) { return AppendVISALscTypedInst(op, pred, execSize, emask, cacheOpts, addrType, - addrSize, data, surface, dstReadBack, Us, Vs, - Rs, LODs, src1AtomicOpnd1, src2AtomicOpnd2); + addrSize, data, + surface, surfaceIndex, dstReadBack, + Us, uOffset, Vs, vOffset, Rs, rOffset, + LODs, src1AtomicOpnd1, src2AtomicOpnd2); } -VISA_BUILDER_API int VISAKernelImpl::AppendVISALscTypedInst( -LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE dataShape, VISA_VectorOpnd *surface, - VISA_RawOpnd *dstData, VISA_RawOpnd *coord0s, VISA_RawOpnd *coord1s, - VISA_RawOpnd *coord2s, VISA_RawOpnd *features, - VISA_RawOpnd *src1Data, VISA_RawOpnd *src2Data) { - - return AppendVISALscTypedInst(subOpcode, pred, execSize, emask, cacheOpts, addrType, - addrSize, dataShape, surface, 0, dstData, coord0s, 0, coord1s, 0, coord2s, - 0, features, src1Data, src2Data); - -} VISA_BUILDER_API int VISAKernelImpl::AppendVISALscTypedInst( LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, diff --git a/visa/include/VISABuilderAPIDefinition.h b/visa/include/VISABuilderAPIDefinition.h index 6211f7e39bde..324a904c825e 100644 --- a/visa/include/VISABuilderAPIDefinition.h +++ b/visa/include/VISABuilderAPIDefinition.h @@ -386,13 +386,15 @@ class VISAKernel { AppendVISALscUntypedLoad(LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, + LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dstData, VISA_RawOpnd *src0Addr) = 0; /// append an *untyped* LSC store operation VISA_BUILDER_API virtual int AppendVISALscUntypedStore( LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, + LSC_ADDR addr, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1Data) = 0; /// append an *untyped* LSC atomic operation // @@ -403,37 +405,12 @@ class VISAKernel { VISA_BUILDER_API virtual int AppendVISALscUntypedAtomic( LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, + LSC_ADDR addr, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dstReadBack, VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1AtomOpnd1 = nullptr, VISA_RawOpnd *src2AtomOpnd2 = nullptr) = 0; - VISA_BUILDER_API virtual int - AppendVISALscUntypedLoad(LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, - LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - unsigned surfaceIndex, VISA_RawOpnd *dstData, - VISA_RawOpnd *src0Addr) = 0; - /// append an *untyped* LSC store operation - VISA_BUILDER_API virtual int AppendVISALscUntypedStore( - LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - unsigned surfaceIndex, VISA_RawOpnd *src0Addr, VISA_RawOpnd *src1Data) = 0; - /// append an *untyped* LSC atomic operation - // - /// atomic unary operations (e.g. lsc_atomic_iinc) take no extra data - /// parameters and can be passed nullptr; atomic binary operations - /// (e.g. lsc_atomic_add) takes src1AtomOpnd1 and leaves src2 nullptr. - /// Atomic ternary (lsc_atomic_{i,f}cas) takes both extra src parameters. - VISA_BUILDER_API virtual int AppendVISALscUntypedAtomic( - LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, - LSC_ADDR addr, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - unsigned surfaceIndex, VISA_RawOpnd *dstReadBack, VISA_RawOpnd *src0Addr, - VISA_RawOpnd *src1AtomOpnd1 = nullptr, - VISA_RawOpnd *src2AtomOpnd2 = nullptr) = 0; // /// A generic constructor for untyped LSC operations. Prefer the explicit /// functions above when possible. The SFID passed in must not be LSC_TGM. @@ -446,13 +423,7 @@ class VISAKernel { VISA_VectorOpnd *surface, unsigned surfaceIndex, VISA_RawOpnd *dst, VISA_RawOpnd *src0, VISA_RawOpnd *src1, VISA_RawOpnd *src2) = 0; - VISA_BUILDER_API virtual int - AppendVISALscUntypedInst(LSC_OP subOpcode, LSC_SFID sfid, VISA_PredOpnd *pred, - VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, - LSC_CACHE_OPTS cacheOpts, LSC_ADDR addr, - LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dst, VISA_RawOpnd *src0, - VISA_RawOpnd *src1, VISA_RawOpnd *src2) = 0; + /// A generic constructor for lsc_load_strided and lsc_store_strided. /// VISA_BUILDER_API virtual int AppendVISALscUntypedStridedInst( @@ -478,15 +449,23 @@ class VISAKernel { VISA_BUILDER_API virtual int AppendVISALscTypedLoad( LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dstData, VISA_RawOpnd *Us, VISA_RawOpnd *Vs, - VISA_RawOpnd *Rs, VISA_RawOpnd *LODs) = 0; + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *dstData, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, + VISA_RawOpnd *LODs) = 0; /// append a *typed* LSC store to this kernel VISA_BUILDER_API virtual int AppendVISALscTypedStore( LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *Us, VISA_RawOpnd *Vs, VISA_RawOpnd *Rs, VISA_RawOpnd *LODs, + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, + VISA_RawOpnd *LODs, VISA_RawOpnd *src1Data) = 0; /// append a *typed* LSC atomic to this kernel; src1 and src2 may be /// nullptr ternary atomic ops (e.g. atomic_icas/atomic_fcas take both @@ -495,18 +474,14 @@ class VISAKernel { VISA_BUILDER_API virtual int AppendVISALscTypedAtomic( LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrModel, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dstReadBack, VISA_RawOpnd *Us, VISA_RawOpnd *Vs, - VISA_RawOpnd *Rs, VISA_RawOpnd *LODs, VISA_RawOpnd *src1AtomicOpnd1, - VISA_RawOpnd *src2AtomicOpnd2) = 0; - /// generic function to append a *typed* LSC load/store/atomic message - /// to this kernel - VISA_BUILDER_API virtual int AppendVISALscTypedInst( - LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, - VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType, - LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, VISA_VectorOpnd *surface, - VISA_RawOpnd *dst, VISA_RawOpnd *coord0s, VISA_RawOpnd *coord1s, - VISA_RawOpnd *coord2s, VISA_RawOpnd *features, VISA_RawOpnd *src1, VISA_RawOpnd *src2) = 0; + LSC_ADDR_SIZE addrSize, LSC_DATA_SHAPE data, + VISA_VectorOpnd *surface, unsigned surfaceIndex, + VISA_RawOpnd *dstReadBack, + VISA_RawOpnd *Us, int uOffset, + VISA_RawOpnd *Vs, int vOffset, + VISA_RawOpnd *Rs, int rOffset, + VISA_RawOpnd *coord3, + VISA_RawOpnd *src1AtomicOpnd1, VISA_RawOpnd *src2AtomicOpnd2) = 0; VISA_BUILDER_API virtual int AppendVISALscTypedInst( LSC_OP subOpcode, VISA_PredOpnd *pred, VISA_Exec_Size execSize, VISA_EMask_Ctrl emask, LSC_CACHE_OPTS cacheOpts, LSC_ADDR_TYPE addrType,