Skip to content

Commit dc36b0b

Browse files
committed
Open Sourcing Gen 11 content for IGC / Clean up fixes in files
Change-Id: Ic329c0e27af25725b41544223f7e5379eb799c3a
1 parent 414c458 commit dc36b0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4107
-600
lines changed

IGC/AdaptorOCL/OCL/sp/gtpin_igc_ocl.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ typedef enum
6969
GEN_ISA_TYPE_GEN7p5 = 3,
7070
GEN_ISA_TYPE_GEN8 = 4,
7171
GEN_ISA_TYPE_GEN9 = 5,
72-
GEN_ISA_TYPE_GEN10 = 6
72+
GEN_ISA_TYPE_GEN10 = 6,
73+
GEN_ISA_TYPE_GEN11 = 7
7374
} GEN_ISA_TYPE;
7475

7576
typedef enum

IGC/BiFModule/Implementation/IGCBiF_Intrinsics.cl

+4
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,10 @@ void __builtin_IB_media_block_write_ulong2(int image, int2 offset, int width, in
589589
void __builtin_IB_media_block_write_ulong4(int image, int2 offset, int width, int height, ulong4 pixels);
590590
void __builtin_IB_media_block_write_ulong8(int image, int2 offset, int width, int height, ulong8 pixels);
591591

592+
int __builtin_IB_dp4a_ss(int c, int a, int b) __attribute__((const));
593+
int __builtin_IB_dp4a_uu(int c, int a, int b) __attribute__((const));
594+
int __builtin_IB_dp4a_su(int c, int a, int b) __attribute__((const));
595+
int __builtin_IB_dp4a_us(int c, int a, int b) __attribute__((const));
592596

593597
short __builtin_IB_sub_group_reduce_OpGroupIAdd_i16(short x) __attribute__((const));
594598
short __builtin_IB_sub_group_reduce_OpGroupSMax_i16(short x) __attribute__((const));

IGC/Compiler/CISACodeGen/CISABuilder.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,19 @@ TARGET_PLATFORM GetVISAPlatform(const CPlatform* platform)
26912691
{
26922692
return GENX_SKL;
26932693
}
2694+
case IGFX_GEN10_CORE:
2695+
return GENX_CNL;
2696+
case IGFX_GEN11_CORE:
2697+
if (platform->getPlatformInfo().eProductFamily == IGFX_ICELAKE_LP ||
2698+
platform->getPlatformInfo().eProductFamily == IGFX_LAKEFIELD ||
2699+
platform->getPlatformInfo().eProductFamily == IGFX_JASPERLAKE)
2700+
{
2701+
return GENX_ICLLP;
2702+
}
2703+
else
2704+
{
2705+
return GENX_ICL;
2706+
}
26942707
default:
26952708
assert(0 && "unsupported platform");
26962709
break;
@@ -2959,6 +2972,8 @@ void CEncoder::GenericAlu(e_opcode opcode, CVariable* dst, CVariable* src0, CVar
29592972
case ISA_OR:
29602973
case ISA_SHL:
29612974
case ISA_SHR:
2975+
case ISA_ROL:
2976+
case ISA_ROR:
29622977
case ISA_XOR:
29632978
LogicOp(visaOpcode, dst, src0, src1, src2);
29642979
break;
@@ -5148,8 +5163,8 @@ void CEncoder::SetVISAWaTable(WA_TABLE const& waTable)
51485163
}
51495164

51505165
if (m_program->m_Platform->supportFtrWddm2Svm() ||
5151-
m_program->m_Platform->GetPlatformFamily() == IGFX_GEN10_CORE
5152-
)
5166+
m_program->m_Platform->GetPlatformFamily() == IGFX_GEN10_CORE ||
5167+
m_program->m_Platform->GetPlatformFamily() == IGFX_GEN11_CORE)
51535168
{
51545169
// no send src/dst overlap when page fault is enabled
51555170
m_WaTable.WaDisableSendSrcDstOverlap = true;

IGC/Compiler/CISACodeGen/CISABuilder.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ class CEncoder
282282
inline void IEEEDivide(CVariable* dst, CVariable* src0, CVariable* src1);
283283
void AddPair(CVariable *Lo, CVariable *Hi, CVariable *L0, CVariable *H0, CVariable *L1, CVariable *H1);
284284
void SubPair(CVariable *Lo, CVariable *Hi, CVariable *L0, CVariable *H0, CVariable *L1, CVariable *H1);
285+
inline void dp4a(CVariable* dst, CVariable* src0, CVariable* src1, CVariable* src2);
285286
// VME
286287
void SendVmeIme(
287288
CVariable* bindingTableIndex,
@@ -784,6 +785,9 @@ inline void CEncoder::IEEEDivide(CVariable* dst, CVariable* src0, CVariable* src
784785
Arithmetic(ISA_DIVM, dst, src0, src1);
785786
}
786787

788+
inline void CEncoder::dp4a(CVariable* dst, CVariable* src0, CVariable* src1, CVariable* src2) {
789+
Arithmetic(ISA_DP4A, dst, src0, src1, src2);
790+
}
787791

788792
inline void CEncoder::SetNoMask()
789793
{

IGC/Compiler/CISACodeGen/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ set(IGC_BUILD__SRC__CISACodeGen_Common
7777
"${CMAKE_CURRENT_SOURCE_DIR}/VertexShaderLowering.cpp"
7878
"${CMAKE_CURRENT_SOURCE_DIR}/WIAnalysis.cpp"
7979
"${CMAKE_CURRENT_SOURCE_DIR}/SLMConstProp.cpp"
80+
"${CMAKE_CURRENT_SOURCE_DIR}/POSH_RemoveNonPositionOutput.cpp"
8081
)
8182

8283

@@ -161,6 +162,7 @@ set(IGC_BUILD__HDR__CISACodeGen_Common
161162
"${CMAKE_CURRENT_SOURCE_DIR}/VertexShaderLowering.hpp"
162163
"${CMAKE_CURRENT_SOURCE_DIR}/WIAnalysis.hpp"
163164
"${CMAKE_CURRENT_SOURCE_DIR}/SLMConstProp.hpp"
165+
"${CMAKE_CURRENT_SOURCE_DIR}/POSH_RemoveNonPositionOutput.h"
164166
)
165167

166168

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -7238,6 +7238,12 @@ void EmitPass::EmitGenIntrinsicMessage(llvm::GenIntrinsicInst* inst)
72387238
case GenISAIntrinsic::GenISA_GetPixelMask:
72397239
emitGetPixelMask(inst);
72407240
break;
7241+
case GenISAIntrinsic::GenISA_dp4a_ss:
7242+
case GenISAIntrinsic::GenISA_dp4a_uu:
7243+
case GenISAIntrinsic::GenISA_dp4a_su:
7244+
case GenISAIntrinsic::GenISA_dp4a_us:
7245+
emitDP4A(inst);
7246+
break;
72417247
case GenISAIntrinsic::GenISA_evaluateSampler:
72427248
// nothing to do
72437249
break;
@@ -13910,4 +13916,29 @@ void EmitPass::emitWaveAll(llvm::GenIntrinsicInst* inst)
1391013916
emitReductionAll(opCode, identity, type, false, src, dst);
1391113917
}
1391213918

13919+
void EmitPass::emitDP4A(GenIntrinsicInst* GII) {
13920+
GenISAIntrinsic::ID GIID = GII->getIntrinsicID();
13921+
CVariable* dst = m_destination;
13922+
CVariable* src0 = GetSymbol(GII->getOperand(0));
13923+
CVariable* src1 = GetSymbol(GII->getOperand(1));
13924+
CVariable* src2 = GetSymbol(GII->getOperand(2));
13925+
// Set correct signedness of src1.
13926+
if (GIID == GenISAIntrinsic::GenISA_dp4a_ss ||
13927+
GIID == GenISAIntrinsic::GenISA_dp4a_su)
13928+
src1 = m_currShader->BitCast(src1, ISA_TYPE_D);
13929+
if (GIID == GenISAIntrinsic::GenISA_dp4a_uu ||
13930+
GIID == GenISAIntrinsic::GenISA_dp4a_us)
13931+
src1 = m_currShader->BitCast(src1, ISA_TYPE_UD);
13932+
// Set correct signedness of src2.
13933+
if (GIID == GenISAIntrinsic::GenISA_dp4a_ss ||
13934+
GIID == GenISAIntrinsic::GenISA_dp4a_us)
13935+
src2 = m_currShader->BitCast(src2, ISA_TYPE_D);
13936+
if (GIID == GenISAIntrinsic::GenISA_dp4a_uu ||
13937+
GIID == GenISAIntrinsic::GenISA_dp4a_su)
13938+
src2 = m_currShader->BitCast(src2, ISA_TYPE_UD);
13939+
// Emit dp4a.
13940+
m_encoder->dp4a(dst, src0, src1, src2);
13941+
m_encoder->Push();
13942+
}
13943+
1391313944

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ class EmitPass : public llvm::FunctionPass
366366
void emitRsq(llvm::Instruction *inst);
367367

368368
void emitLLVMbswap(llvm::IntrinsicInst* inst);
369+
void emitDP4A(llvm::GenIntrinsicInst *GII);
369370
// Debug Built-Ins
370371
void emitStateRegID(uint64_t and_imm, uint64_t shr_imm);
371372

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*===================== begin_copyright_notice ==================================
2+
3+
Copyright (c) 2017 Intel Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a
6+
copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included
14+
in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
24+
25+
======================= end_copyright_notice ==================================*/
26+
27+
#include "Compiler/IGCPassSupport.h"
28+
#include "common/LLVMWarningsPush.hpp"
29+
#include "llvm/IR/InstIterator.h"
30+
#include "common/LLVMWarningsPop.hpp"
31+
#include "GenISAIntrinsics/GenIntrinsicInst.h"
32+
#include "Compiler/CodeGenPublicEnums.h"
33+
#include "Compiler/CISACodeGen/helper.h"
34+
35+
#include <llvm/IR/PassManager.h>
36+
37+
using namespace IGC;
38+
using namespace llvm;
39+
40+
class RemoveNonPositionOutput : public llvm::FunctionPass
41+
{
42+
public:
43+
static char ID;
44+
45+
RemoveNonPositionOutput();
46+
47+
~RemoveNonPositionOutput() {}
48+
49+
virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const override
50+
{
51+
AU.setPreservesCFG();
52+
}
53+
54+
virtual bool runOnFunction(llvm::Function &F) override;
55+
56+
virtual llvm::StringRef getPassName() const override
57+
{
58+
return "remove non-position output in vertex shader";
59+
}
60+
};
61+
62+
llvm::FunctionPass* createRemoveNonPositionOutputPass()
63+
{
64+
return new RemoveNonPositionOutput();
65+
}
66+
67+
// Register pass to igc-opt
68+
#define PASS_FLAG_POSH "igc-remove-nonposition-output"
69+
#define PASS_DESCRIPTION_POSH "Custom Pass for Position-Only Shader"
70+
#define PASS_CFG_ONLY_POSH false
71+
#define PASS_ANALYSIS_POSH false
72+
IGC_INITIALIZE_PASS_BEGIN(RemoveNonPositionOutput, PASS_FLAG_POSH, PASS_DESCRIPTION_POSH, PASS_CFG_ONLY_POSH, PASS_ANALYSIS_POSH)
73+
IGC_INITIALIZE_PASS_END(RemoveNonPositionOutput, PASS_FLAG_POSH, PASS_DESCRIPTION_POSH, PASS_CFG_ONLY_POSH, PASS_ANALYSIS_POSH)
74+
75+
char RemoveNonPositionOutput::ID = 0;
76+
77+
RemoveNonPositionOutput::RemoveNonPositionOutput() : FunctionPass(ID)
78+
{
79+
initializeRemoveNonPositionOutputPass(*PassRegistry::getPassRegistry());
80+
}
81+
82+
bool RemoveNonPositionOutput::runOnFunction(Function &F)
83+
{
84+
// Initialize the worklist to all of the instructions ready to process...
85+
SmallVector<Instruction*, 10> instructionToRemove;
86+
for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II)
87+
{
88+
if (GenIntrinsicInst *inst = dyn_cast<GenIntrinsicInst>(&*II))
89+
{
90+
if (inst->getIntrinsicID() == GenISAIntrinsic::GenISA_OUTPUT)
91+
{
92+
const ShaderOutputType usage = static_cast<ShaderOutputType>(
93+
llvm::cast<llvm::ConstantInt>(inst->getOperand(4))->getZExtValue());
94+
if (usage != SHADER_OUTPUT_TYPE_POSITION &&
95+
usage != SHADER_OUTPUT_TYPE_POINTWIDTH &&
96+
usage != SHADER_OUTPUT_TYPE_VIEWPORT_ARRAY_INDEX &&
97+
usage != SHADER_OUTPUT_TYPE_CLIPDISTANCE_LO &&
98+
usage != SHADER_OUTPUT_TYPE_CLIPDISTANCE_HI)
99+
{
100+
instructionToRemove.push_back(inst);
101+
}
102+
}
103+
}
104+
}
105+
bool changed = false;
106+
uint num = instructionToRemove.size();
107+
for (uint i = 0; i < num; ++i)
108+
{
109+
instructionToRemove[i]->eraseFromParent();
110+
changed = true;
111+
}
112+
return changed;
113+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*===================== begin_copyright_notice ==================================
2+
3+
Copyright (c) 2017 Intel Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a
6+
copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included
14+
in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
24+
25+
======================= end_copyright_notice ==================================*/
26+
27+
#pragma once
28+
29+
llvm::FunctionPass* createRemoveNonPositionOutputPass();

0 commit comments

Comments
 (0)