tensorflow / mlir

"Multi-Level Intermediate Representation" Compiler Infrastructure
1.74k stars 259 forks source link

Build errors - NVVMConversions, ROCDLConversions #318

Closed bondhugula closed 4 years ago

bondhugula commented 4 years ago

The trunk doesn't build (both release and debug builds). (LLVM trunk: ed83942bc02501c62b55f77cba688263ea35221a )

/usr/lib64/ccache/clang++  -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/mlir/lib/Target -I/home/uday/llvm-project/llvm/projects/mlir/lib/Target -I/usr/include/libxml2 -Iinclude -I/home/uday/llvm-project/llvm/include -I/home/uday/llvm-project/llvm/projects/mlir/include -Iprojects/mlir/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -DNDEBUG    -fno-exceptions -fno-rtti -std=c++14 -MD -MT projects/mlir/lib/Target/CMakeFiles/MLIRTargetNVVMIR.dir/LLVMIR/ConvertToNVVMIR.cpp.o -MF projects/mlir/lib/Target/CMakeFiles/MLIRTargetNVVMIR.dir/LLVMIR/ConvertToNVVMIR.cpp.o.d -o projects/mlir/lib/Target/CMakeFiles/MLIRTargetNVVMIR.dir/LLVMIR/ConvertToNVVMIR.cpp.o -c /home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp
/home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp:51:55: error: no member named 'nvvm_shfl_sync_bfly_f32p' in namespace 'llvm::Intrinsic'
    return resultType->isFloatTy() ? llvm::Intrinsic::nvvm_shfl_sync_bfly_f32p
                                     ~~~~~~~~~~~~~~~~~^
/home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp:52:55: error: no member named 'nvvm_shfl_sync_bfly_i32p' in namespace 'llvm::Intrinsic'
                                   : llvm::Intrinsic::nvvm_shfl_sync_bfly_i32p;
                                     ~~~~~~~~~~~~~~~~~^
/home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp:54:53: error: no member named 'nvvm_shfl_sync_bfly_f32' in namespace 'llvm::Intrinsic'
  return resultType->isFloatTy() ? llvm::Intrinsic::nvvm_shfl_sync_bfly_f32
                                   ~~~~~~~~~~~~~~~~~^
/home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp:55:53: error: no member named 'nvvm_shfl_sync_bfly_i32' in namespace 'llvm::Intrinsic'
                                 : llvm::Intrinsic::nvvm_shfl_sync_bfly_i32;
                                   ~~~~~~~~~~~~~~~~~^
In file included from /home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp:69:
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:3:53: error: no member named 'nvvm_barrier0' in namespace 'llvm::Intrinsic'
      createIntrinsicCall(builder, llvm::Intrinsic::nvvm_barrier0);
                                   ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:8:71: error: no member named 'nvvm_read_ptx_sreg_ntid_x' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_x);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:12:71: error: no member named 'nvvm_read_ptx_sreg_ntid_y' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_y);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:16:71: error: no member named 'nvvm_read_ptx_sreg_ntid_z' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_z);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:20:71: error: no member named 'nvvm_read_ptx_sreg_ctaid_x' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_ctaid_x);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:24:71: error: no member named 'nvvm_read_ptx_sreg_ctaid_y' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_ctaid_y);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:28:71: error: no member named 'nvvm_read_ptx_sreg_ctaid_z' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_ctaid_z);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:32:71: error: no member named 'nvvm_read_ptx_sreg_nctaid_x' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_nctaid_x);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:36:71: error: no member named 'nvvm_read_ptx_sreg_nctaid_y' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_nctaid_y);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:40:71: error: no member named 'nvvm_read_ptx_sreg_nctaid_z' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_nctaid_z);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:44:71: error: no member named 'nvvm_read_ptx_sreg_laneid' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_laneid);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:50:35: error: no member named 'nvvm_mma_m8n8k4_row_row_f32_f32' in namespace 'llvm::Intrinsic'
        builder, llvm::Intrinsic::nvvm_mma_m8n8k4_row_row_f32_f32, lookupValues(op.args()));
                 ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:64:71: error: no member named 'nvvm_read_ptx_sreg_tid_x' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_tid_x);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:68:71: error: no member named 'nvvm_read_ptx_sreg_tid_y' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_tid_y);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc:72:71: error: no member named 'nvvm_read_ptx_sreg_tid_z' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::nvvm_read_ptx_sreg_tid_z);
                                                     ~~~~~~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

[211/399] Building CXX object projects/mlir/lib/Dialect/StandardOps/CMakeFiles/MLIRStandardOps.dir/Ops.cpp.o
/home/uday/llvm-project/llvm/projects/mlir/lib/Dialect/StandardOps/Ops.cpp:712:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
  default:
  ^
/home/uday/llvm-project/llvm/projects/mlir/lib/Dialect/StandardOps/Ops.cpp:2734:13: warning: unused function 'hasConstantOffsetSizesAndStrides' [-Wunused-function]
static bool hasConstantOffsetSizesAndStrides(MemRefType memrefType) {
            ^
2 warnings generated.
[212/399] Building CXX object projects/mlir/lib/Target/CMakeFiles/MLIRTargetROCDLIR.dir/LLVMIR/ConvertToROCDLIR.cpp.o
FAILED: projects/mlir/lib/Target/CMakeFiles/MLIRTargetROCDLIR.dir/LLVMIR/ConvertToROCDLIR.cpp.o 
/usr/lib64/ccache/clang++  -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/mlir/lib/Target -I/home/uday/llvm-project/llvm/projects/mlir/lib/Target -I/usr/include/libxml2 -Iinclude -I/home/uday/llvm-project/llvm/include -I/home/uday/llvm-project/llvm/projects/mlir/include -Iprojects/mlir/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -DNDEBUG    -fno-exceptions -fno-rtti -std=c++14 -MD -MT projects/mlir/lib/Target/CMakeFiles/MLIRTargetROCDLIR.dir/LLVMIR/ConvertToROCDLIR.cpp.o -MF projects/mlir/lib/Target/CMakeFiles/MLIRTargetROCDLIR.dir/LLVMIR/ConvertToROCDLIR.cpp.o.d -o projects/mlir/lib/Target/CMakeFiles/MLIRTargetROCDLIR.dir/LLVMIR/ConvertToROCDLIR.cpp.o -c /home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToROCDLIR.cpp
In file included from /home/uday/llvm-project/llvm/projects/mlir/lib/Target/LLVMIR/ConvertToROCDLIR.cpp:80:
projects/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc:14:71: error: no member named 'amdgcn_workgroup_id_x' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::amdgcn_workgroup_id_x);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc:18:71: error: no member named 'amdgcn_workgroup_id_y' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::amdgcn_workgroup_id_y);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc:22:71: error: no member named 'amdgcn_workgroup_id_z' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::amdgcn_workgroup_id_z);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc:38:71: error: no member named 'amdgcn_workitem_id_x' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::amdgcn_workitem_id_x);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc:42:71: error: no member named 'amdgcn_workitem_id_y' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::amdgcn_workitem_id_y);
                                                     ~~~~~~~~~~~~~~~~~^
projects/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc:46:71: error: no member named 'amdgcn_workitem_id_z' in namespace 'llvm::Intrinsic'
valueMapping[op.res()] = createIntrinsicCall(builder,llvm::Intrinsic::amdgcn_workitem_id_z);
                                                     ~~~~~~~~~~~~~~~~~^
6 errors generated.
[217/399] Building CXX object projects/mlir/lib/Dialect/SPIRV/CMakeFiles/MLIRSPIRV.dir/SPIRVOps.cpp.o
In file included from /home/uday/llvm-project/llvm/projects/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp:475:
projects/mlir/lib/Dialect/SPIRV/SPIRVCanonicalization.inc:231:6: warning: unused function 'populateWithGenerated' [-Wunused-function]
void populateWithGenerated(MLIRContext *context, OwningRewritePatternList *patterns) {
     ^
1 warning generated.
[223/399] Building CXX object projects/mlir/lib/Target/CMakeFiles/MLIRTargetLLVMIRModuleTranslation.dir/LLVMIR/ModuleTranslation.cpp.o
ninja: build stopped: subcommand failed.
sriongh commented 4 years ago

I believe its due to the following llvm commit : https://github.com/llvm/llvm-project/commit/5d986953c8b917bacfaa1f800fc1e242559f76be#diff-e4d14cf1af1adc71fd93a0f451d98f6a

I was able to resolve it by adding the following:

Adding #include "llvm/IR/IntrinsicsNVPTX.h" to lib/Target/LLVMIR/ConvertToNVVMIR.cpp Adding #include "llvm/IR/IntrinsicsAMDGPU.h" to lib/Target/LLVMIR/ConvertToROCDLIR.cpp

WenleiBao commented 4 years ago

It works. Thanks.

joker-eph commented 4 years ago

We're integrating LLVM from upstream into our internal repository every day or so (sometimes LLVM is in a bad state and it takes multiple days), and we fix the APIs along the way. Right now we're at 5bcd34a03ff343674c106b9a6a0406bf249b9b31 Please re-open if you still see the issue at that revision.