diff options
author | Jianyu Huang <jianyuhuang@fb.com> | 2019-08-06 21:55:17 +0300 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-08-06 21:59:00 +0300 |
commit | cf34b9a26b609109b18d6498f0608faddb7a911b (patch) | |
tree | 1ceaddaf942edb9debcafad7491b750fc3a5f066 /src/GenerateKernelU8S8S32ACC32.cc | |
parent | d8b3323668fdd15dc70e9cb43ab16e96f4846eeb (diff) |
Back out "[fbgemm] Integrate VNNI into FBGEMM master branch"
Summary:
Original commit changeset: fcaa13cc3159
ASMJIT requires the CMake version to be 3.8
However, FBGEMM and PyTorch only need the CMake version to be 3.5+.
This caused the build failure in FBGEMM:
https://circleci.com/gh/pytorch/FBGEMM/122#build-timing/containers/0
Reviewed By: dskhudia
Differential Revision: D16670547
fbshipit-source-id: 506714c3db1cb82cf98895f58f82f235128f5285
Diffstat (limited to 'src/GenerateKernelU8S8S32ACC32.cc')
-rw-r--r-- | src/GenerateKernelU8S8S32ACC32.cc | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/src/GenerateKernelU8S8S32ACC32.cc b/src/GenerateKernelU8S8S32ACC32.cc index 6b54743..58643ad 100644 --- a/src/GenerateKernelU8S8S32ACC32.cc +++ b/src/GenerateKernelU8S8S32ACC32.cc @@ -31,7 +31,7 @@ template <> template <> void CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::initCRegs< inst_set_t::avx2>( - x86::Emitter* a, + asmjit::X86Emitter* a, int rowRegs, int colRegs, int leadingDimCReg) { @@ -53,25 +53,25 @@ template <> template <> void CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::genComputeBlock< inst_set_t::avx2>( - x86::Emitter* a, - x86::Gp buffer_A, - x86::Gp buffer_B, - x86::Gp B_pf, + asmjit::X86Emitter* a, + asmjit::X86Gp buffer_A, + asmjit::X86Gp buffer_B, + asmjit::X86Gp B_pf, int rowRegs, int colRegs, int lda, int leadingDimCReg) { // used for matrix A - x86::Ymm AReg = x86::ymm12; + asmjit::X86Ymm AReg = x86::ymm12; // used for matrix B - x86::Ymm BReg = x86::ymm13; + asmjit::X86Ymm BReg = x86::ymm13; // Contains 16-bit 1s - x86::Ymm oneReg = x86::ymm15; + asmjit::X86Ymm oneReg = x86::ymm15; // temporary register - x86::Ymm res1 = x86::ymm14; + asmjit::X86Ymm res1 = x86::ymm14; for (int j = 0; j < colRegs; ++j) { // load B @@ -99,11 +99,11 @@ template <> template <> void CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::storeCRegs< inst_set_t::avx2>( - x86::Emitter* a, + asmjit::X86Emitter* a, int rowRegs, int colRegs, - x86::Gp C_Offset, - x86::Gp ldcReg, + asmjit::X86Gp C_Offset, + asmjit::X86Gp ldcReg, bool accum, int leadingDimCReg) { for (int i = 0; i < rowRegs; ++i) { @@ -177,9 +177,9 @@ CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreate<inst_set_t::avx2>( return codeCache_[kernelSig]; } code_.reset(false); - code_.init(rt_.codeInfo()); - x86::Assembler assembler(&code_); - x86::Emitter* a = assembler.as<x86::Emitter>(); + code_.init(rt_.getCodeInfo()); + asmjit::X86Assembler assembler(&code_); + asmjit::X86Emitter* a = assembler.asEmitter(); #if defined(FBGEMM_LOG_CODE) // generated code logging FILE* codeLogfile = fopen( @@ -205,48 +205,49 @@ CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreate<inst_set_t::avx2>( int mRegBlocksRem = mc % mRegBlockSize; // arguments to the function created - x86::Gp buffer_A = a->zdi(); - x86::Gp buffer_B = a->zsi(); - x86::Gp B_pf = a->zdx(); - x86::Gp CBase = a->zcx(); - x86::Gp kSize = a->gpz(8); - x86::Gp ldcReg = a->gpz(9); + asmjit::X86Gp buffer_A = a->zdi(); + asmjit::X86Gp buffer_B = a->zsi(); + asmjit::X86Gp B_pf = a->zdx(); + asmjit::X86Gp CBase = a->zcx(); + asmjit::X86Gp kSize = a->gpzRef(8); + asmjit::X86Gp ldcReg = a->gpzRef(9); asmjit::FuncDetail func; func.init( asmjit:: - FuncSignatureT<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>( + FuncSignature6<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>( asmjit::CallConv::kIdHost)); - asmjit::FuncFrame frame; - frame.init(func); - frame.setDirtyRegs( - x86::Reg::kGroupVec, - asmjit::Support::bitMask(0, 1, 2, 3, 4, 5, 6, 7) | - asmjit::Support::bitMask(8, 9, 10, 11, 12, 13, 14, 15)); - frame.setDirtyRegs( - x86::Reg::kGroupGp, asmjit::Support::bitMask(8, 9, 10, 11, 12, 13, 14)); + asmjit::FuncFrameInfo ffi; + ffi.setDirtyRegs( + asmjit::X86Reg::kKindVec, + asmjit::Utils::mask(0, 1, 2, 3, 4, 5, 6, 7) | + asmjit::Utils::mask(8, 9, 10, 11, 12, 13, 14, 15)); + ffi.setDirtyRegs( + asmjit::X86Reg::kKindGp, asmjit::Utils::mask(8, 9, 10, 11, 12, 13, 14)); - asmjit::FuncArgsAssignment args(&func); + asmjit::FuncArgsMapper args(&func); args.assignAll(buffer_A, buffer_B, B_pf, CBase, kSize, ldcReg); - args.updateFuncFrame(frame); - frame.finalize(); + args.updateFrameInfo(ffi); - a->emitProlog(frame); - a->emitArgsAssignment(frame, args); + asmjit::FuncFrameLayout layout; + layout.init(func, ffi); + + asmjit::FuncUtils::emitProlog(a, layout); + asmjit::FuncUtils::allocArgs(a, layout, args); asmjit::Label Loopk = a->newLabel(); asmjit::Label LoopMBlocks = a->newLabel(); - x86::Gp buffer_B_saved = a->gpz(10); - x86::Gp C_Offset = a->gpz(11); - x86::Gp B_pf_saved = a->gpz(12); - x86::Gp iIdx = a->gpz(13); - x86::Gp kIdx = a->gpz(14); - // x86::Gp B_pf = a->gpz(8); + asmjit::X86Gp buffer_B_saved = a->gpzRef(10); + asmjit::X86Gp C_Offset = a->gpzRef(11); + asmjit::X86Gp B_pf_saved = a->gpzRef(12); + asmjit::X86Gp iIdx = a->gpzRef(13); + asmjit::X86Gp kIdx = a->gpzRef(14); + // asmjit::X86Gp B_pf = a->gpzRef(8); - x86::Ymm oneReg = x86::ymm15; + asmjit::X86Ymm oneReg = x86::ymm15; // create 16-bit 1s // i.e., oneReg[0:15] contains 0x0001, oneReg[16:31] contains 0x0001 // and so on @@ -357,7 +358,7 @@ CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreate<inst_set_t::avx2>( a, rowRegs, colRegs, C_Offset, ldcReg, accum, colRegs); } - a->emitEpilog(frame); + asmjit::FuncUtils::emitEpilog(a, layout); jit_micro_kernel_fp fn; asmjit::Error err = rt_.add(&fn, &code_); |