Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 922435
Collapse All | Expand All

(-)a/include/LLVMSPIRVExtensions.inc (-1 / +1 lines)
Lines 41-47 EXT(SPV_INTEL_variable_length_array) Link Here
41
EXT(SPV_INTEL_fp_fast_math_mode)
41
EXT(SPV_INTEL_fp_fast_math_mode)
42
EXT(SPV_INTEL_fpga_cluster_attributes)
42
EXT(SPV_INTEL_fpga_cluster_attributes)
43
EXT(SPV_INTEL_loop_fuse)
43
EXT(SPV_INTEL_loop_fuse)
44
EXT(SPV_INTEL_long_constant_composite)
44
EXT(SPV_INTEL_long_composites)
45
EXT(SPV_INTEL_optnone)
45
EXT(SPV_INTEL_optnone)
46
EXT(SPV_INTEL_fpga_dsp_control)
46
EXT(SPV_INTEL_fpga_dsp_control)
47
EXT(SPV_INTEL_memory_access_aliasing)
47
EXT(SPV_INTEL_memory_access_aliasing)
(-)a/lib/SPIRV/SPIRVWriter.cpp (-7 / +4 lines)
Lines 409-419 SPIRVType *LLVMToSPIRVBase::transType(Type *T) { Link Here
409
    const size_t NumElements = ST->getNumElements();
409
    const size_t NumElements = ST->getNumElements();
410
    size_t SPIRVStructNumElements = NumElements;
410
    size_t SPIRVStructNumElements = NumElements;
411
    // In case number of elements is greater than maximum WordCount and
411
    // In case number of elements is greater than maximum WordCount and
412
    // SPV_INTEL_long_constant_composite is not enabled, the error will be
412
    // SPV_INTEL_long_composites is not enabled, the error will be
413
    // emitted by validate functionality of SPIRVTypeStruct class.
413
    // emitted by validate functionality of SPIRVTypeStruct class.
414
    if (NumElements > MaxNumElements &&
414
    if (NumElements > MaxNumElements &&
415
        BM->isAllowedToUseExtension(
415
        BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_composites)) {
416
            ExtensionID::SPV_INTEL_long_constant_composite)) {
417
      SPIRVStructNumElements = MaxNumElements;
416
      SPIRVStructNumElements = MaxNumElements;
418
    }
417
    }
419
418
Lines 421-428 SPIRVType *LLVMToSPIRVBase::transType(Type *T) { Link Here
421
    mapType(T, Struct);
420
    mapType(T, Struct);
422
421
423
    if (NumElements > MaxNumElements &&
422
    if (NumElements > MaxNumElements &&
424
        BM->isAllowedToUseExtension(
423
        BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_composites)) {
425
            ExtensionID::SPV_INTEL_long_constant_composite)) {
426
      uint64_t NumOfContinuedInstructions = NumElements / MaxNumElements - 1;
424
      uint64_t NumOfContinuedInstructions = NumElements / MaxNumElements - 1;
427
      for (uint64_t J = 0; J < NumOfContinuedInstructions; J++) {
425
      for (uint64_t J = 0; J < NumOfContinuedInstructions; J++) {
428
        auto *Continued = BM->addTypeStructContinuedINTEL(MaxNumElements);
426
        auto *Continued = BM->addTypeStructContinuedINTEL(MaxNumElements);
Lines 1832-1839 LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB, Link Here
1832
      } else
1830
      } else
1833
        BVarInit = I->second;
1831
        BVarInit = I->second;
1834
    } else if (Init && !isa<UndefValue>(Init)) {
1832
    } else if (Init && !isa<UndefValue>(Init)) {
1835
      if (!BM->isAllowedToUseExtension(
1833
      if (!BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_composites)) {
1836
              ExtensionID::SPV_INTEL_long_constant_composite)) {
1837
        if (auto ArrTy = dyn_cast_or_null<ArrayType>(Init->getType())) {
1834
        if (auto ArrTy = dyn_cast_or_null<ArrayType>(Init->getType())) {
1838
          // First 3 words of OpConstantComposite encode: 1) word count &
1835
          // First 3 words of OpConstantComposite encode: 1) word count &
1839
          // opcode, 2) Result Type and 3) Result Id. Max length of SPIRV
1836
          // opcode, 2) Result Type and 3) Result Id. Max length of SPIRV
(-)a/lib/SPIRV/libSPIRV/SPIRVEntry.h (-2 / +2 lines)
Lines 908-918 public: Link Here
908
  }
908
  }
909
909
910
  SPIRVCapVec getRequiredCapability() const override {
910
  SPIRVCapVec getRequiredCapability() const override {
911
    return getVec(CapabilityLongConstantCompositeINTEL);
911
    return getVec(CapabilityLongCompositesINTEL);
912
  }
912
  }
913
913
914
  std::optional<ExtensionID> getRequiredExtension() const override {
914
  std::optional<ExtensionID> getRequiredExtension() const override {
915
    return ExtensionID::SPV_INTEL_long_constant_composite;
915
    return ExtensionID::SPV_INTEL_long_composites;
916
  }
916
  }
917
917
918
  SPIRVWord getNumElements() const { return Elements.size(); }
918
  SPIRVWord getNumElements() const { return Elements.size(); }
(-)a/lib/SPIRV/libSPIRV/SPIRVModule.cpp (-3 / +3 lines)
Lines 1175-1184 SPIRVValue *SPIRVModuleImpl::addCompositeConstant( Link Here
1175
  const int NumElements = Elements.size();
1175
  const int NumElements = Elements.size();
1176
1176
1177
  // In case number of elements is greater than maximum WordCount and
1177
  // In case number of elements is greater than maximum WordCount and
1178
  // SPV_INTEL_long_constant_composite is not enabled, the error will be emitted
1178
  // SPV_INTEL_long_composites is not enabled, the error will be emitted
1179
  // by validate functionality of SPIRVCompositeConstant class.
1179
  // by validate functionality of SPIRVCompositeConstant class.
1180
  if (NumElements <= MaxNumElements ||
1180
  if (NumElements <= MaxNumElements ||
1181
      !isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_constant_composite))
1181
      !isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_composites))
1182
    return addConstant(new SPIRVConstantComposite(this, Ty, getId(), Elements));
1182
    return addConstant(new SPIRVConstantComposite(this, Ty, getId(), Elements));
1183
1183
1184
  auto Start = Elements.begin();
1184
  auto Start = Elements.begin();
Lines 1213-1219 SPIRVValue *SPIRVModuleImpl::addSpecConstantComposite( Link Here
1213
  // SPV_INTEL_long_constant_composite is not enabled, the error will be emitted
1213
  // SPV_INTEL_long_constant_composite is not enabled, the error will be emitted
1214
  // by validate functionality of SPIRVSpecConstantComposite class.
1214
  // by validate functionality of SPIRVSpecConstantComposite class.
1215
  if (NumElements <= MaxNumElements ||
1215
  if (NumElements <= MaxNumElements ||
1216
      !isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_constant_composite))
1216
      !isAllowedToUseExtension(ExtensionID::SPV_INTEL_long_composites))
1217
    return addConstant(
1217
    return addConstant(
1218
        new SPIRVSpecConstantComposite(this, Ty, getId(), Elements));
1218
        new SPIRVSpecConstantComposite(this, Ty, getId(), Elements));
1219
1219
(-)a/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h (-1 / +1 lines)
Lines 610-616 template <> inline void SPIRVMap<Capability, std::string>::init() { Link Here
610
  add(CapabilityGroupNonUniformRotateKHR, "GroupNonUniformRotateKHR");
610
  add(CapabilityGroupNonUniformRotateKHR, "GroupNonUniformRotateKHR");
611
  add(CapabilityAtomicFloat32AddEXT, "AtomicFloat32AddEXT");
611
  add(CapabilityAtomicFloat32AddEXT, "AtomicFloat32AddEXT");
612
  add(CapabilityAtomicFloat64AddEXT, "AtomicFloat64AddEXT");
612
  add(CapabilityAtomicFloat64AddEXT, "AtomicFloat64AddEXT");
613
  add(CapabilityLongConstantCompositeINTEL, "LongConstantCompositeINTEL");
613
  add(CapabilityLongCompositesINTEL, "LongCompositesINTEL");
614
  add(CapabilityOptNoneINTEL, "OptNoneINTEL");
614
  add(CapabilityOptNoneINTEL, "OptNoneINTEL");
615
  add(CapabilityAtomicFloat16AddEXT, "AtomicFloat16AddEXT");
615
  add(CapabilityAtomicFloat16AddEXT, "AtomicFloat16AddEXT");
616
  add(CapabilityDebugInfoModuleINTEL, "DebugInfoModuleINTEL");
616
  add(CapabilityDebugInfoModuleINTEL, "DebugInfoModuleINTEL");
(-)a/test/SpecConstants/long-spec-const-composite.ll (-3 / +3 lines)
Lines 1-5 Link Here
1
; RUN: llvm-as %s -o %t.bc
1
; RUN: llvm-as %s -o %t.bc
2
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite %t.bc -o %t.spv
2
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_composites %t.bc -o %t.spv
3
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
4
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
4
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
5
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
5
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
Lines 11-18 Link Here
11
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
11
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
12
target triple = "spir64-unknown-unknown"
12
target triple = "spir64-unknown-unknown"
13
13
14
; CHECK-SPIRV: Capability LongConstantCompositeINTEL 
14
; CHECK-SPIRV: Capability LongCompositesINTEL
15
; CHECK-SPIRV: Extension "SPV_INTEL_long_constant_composite"
15
; CHECK-SPIRV: Extension "SPV_INTEL_long_composites"
16
; CHECK-SPIRV-DAG: Decorate [[First:[0-9]+]] SpecId  0
16
; CHECK-SPIRV-DAG: Decorate [[First:[0-9]+]] SpecId  0
17
; CHECK-SPIRV-DAG: Decorate [[Last:[0-9]+]] SpecId 65548
17
; CHECK-SPIRV-DAG: Decorate [[Last:[0-9]+]] SpecId 65548
18
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
18
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
(-)a/test/long-constant-array.ll (-4 / +4 lines)
Lines 1-16 Link Here
1
; RUN: llvm-as %s -o %t.bc
1
; RUN: llvm-as %s -o %t.bc
2
; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
2
; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
3
3
4
; Check that everything is fine if SPV_INTEL_long_constant_composite is enabled
4
; Check that everything is fine if SPV_INTEL_long_composites is enabled
5
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite %t.bc -o %t.spv
5
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_composites %t.bc -o %t.spv
6
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
6
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
7
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
7
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
8
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
8
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
9
; TODO: run validator once it supports the extension
9
; TODO: run validator once it supports the extension
10
; RUNx: spirv-val %t.spv
10
; RUNx: spirv-val %t.spv
11
11
12
; CHECK-SPIRV: Capability LongConstantCompositeINTEL 
12
; CHECK-SPIRV: Capability LongCompositesINTEL
13
; CHECK-SPIRV: Extension "SPV_INTEL_long_constant_composite"
13
; CHECK-SPIRV: Extension "SPV_INTEL_long_composites"
14
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
14
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
15
; CHECK-SPIRV: Constant {{[0-9]+}} [[ArrSize:[0-9]+]] 78000
15
; CHECK-SPIRV: Constant {{[0-9]+}} [[ArrSize:[0-9]+]] 78000
16
; CHECK-SPIRV: TypeArray [[TArr:[0-9]+]] [[TInt]] [[ArrSize]]
16
; CHECK-SPIRV: TypeArray [[TArr:[0-9]+]] [[TInt]] [[ArrSize]]
(-)a/test/long-type-struct.ll (-4 / +4 lines)
Lines 1-8 Link Here
1
; RUN: llvm-as %s -o %t.bc
1
; RUN: llvm-as %s -o %t.bc
2
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite %t.bc -o %t.spv
2
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_composites %t.bc -o %t.spv
3
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
4
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
4
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
5
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite -spirv-text %t.rev.bc -o %t2.spt
5
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_composites -spirv-text %t.rev.bc -o %t2.spt
6
; RUN: FileCheck --input-file=%t2.spt %s --check-prefix=CHECK-SPIRV
6
; RUN: FileCheck --input-file=%t2.spt %s --check-prefix=CHECK-SPIRV
7
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
8
; TODO: run validator once it supports the extension
8
; TODO: run validator once it supports the extension
Lines 10-17 Link Here
10
10
11
; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
11
; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
12
12
13
; CHECK-SPIRV: Capability LongConstantCompositeINTEL 
13
; CHECK-SPIRV: Capability LongCompositesINTEL
14
; CHECK-SPIRV: Extension "SPV_INTEL_long_constant_composite"
14
; CHECK-SPIRV: Extension "SPV_INTEL_long_composites"
15
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
15
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
16
; CHECK-SPIRV: TypePointer [[TIntPtr:[0-9]+]] 8 [[TInt]]
16
; CHECK-SPIRV: TypePointer [[TIntPtr:[0-9]+]] 8 [[TInt]]
17
; CHECK-SPIRV: TypeArray [[TArr:[0-9]+]]
17
; CHECK-SPIRV: TypeArray [[TArr:[0-9]+]]

Return to bug 922435