Skip to content

Segfault in SPIRV compilation when built on GCC Release mode #2570

Closed

Description

@stellaraccident

Does not happen in debug mode. Repros on gcc 9.1.

Stack trace:

#0  llvm::hashing::detail::hash_combine_range_impl<char const> (first=<optimized out>, last=0x86c28b0 <error: Cannot access memory at address 0x86c28b0>) at /work/iree/third_party/llvm-project/llvm/include/llvm/ADT/Hashing.h:294
#1  0x0000000000b871f0 in llvm::DenseMapInfo<llvm::StringRef>::getHashValue (Val=...) at /work/iree/third_party/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:303
#2  llvm::DenseMapInfo<std::pair<llvm::StringRef, mlir::Type> >::getHashValue (PairVal={...}) at /work/iree/third_party/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:227
#3  mlir::StorageUniquer::getHash<mlir::detail::StringAttributeStorage, std::pair<llvm::StringRef, mlir::Type> > (derivedKey={...}, kind=<optimized out>) at /work/iree/third_party/llvm-project/mlir/include/mlir/Support/StorageUniquer.h:256
#4  mlir::StorageUniquer::get<mlir::detail::StringAttributeStorage, llvm::StringRef&, mlir::Type&>(llvm::function_ref<void (mlir::detail::StringAttributeStorage*)>, unsigned int, llvm::StringRef&, mlir::Type&) (arg=<synthetic pointer>..., kind=7, initFn=..., this=0x42c4d90)
    at /work/iree/third_party/llvm-project/mlir/include/mlir/Support/StorageUniquer.h:135
#5  mlir::detail::AttributeUniquer::get<mlir::StringAttr, llvm::StringRef&, mlir::Type&> (kind=7, ctx=<optimized out>) at /work/iree/third_party/llvm-project/mlir/include/mlir/IR/AttributeSupport.h:139
#6  mlir::detail::StorageUserBase<mlir::StringAttr, mlir::Attribute, mlir::detail::StringAttributeStorage, mlir::detail::AttributeUniquer>::get<llvm::StringRef, mlir::Type> (kind=7, ctx=<optimized out>)
    at /work/iree/third_party/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:94
#7  mlir::StringAttr::get (bytes=..., type=...) at /work/iree/third_party/llvm-project/mlir/lib/IR/Attributes.cpp:432
#8  0x0000000000b8732a in mlir::StringAttr::get (bytes=..., context=<optimized out>) at /work/iree/third_party/llvm-project/mlir/lib/IR/Attributes.cpp:427
#9  0x0000000000b8ecd1 in mlir::Builder::getStringAttr (this=this@entry=0x7fffffffc2d8, bytes=...) at /work/iree/third_party/llvm-project/mlir/lib/IR/Builders.cpp:200
#10 0x0000000000b3d4c2 in mlir::iree_compiler::getGPUProcessorIdAndCount<mlir::gpu::BlockIdOp, mlir::gpu::GridDimOp> (rewriter=..., dim=..., loc=...) at /work/iree/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp:397
#11 mlir::iree_compiler::getGPUProcessorIdsAndCounts<mlir::gpu::BlockIdOp, mlir::gpu::GridDimOp> (loc=..., rewriter=..., numDims=<optimized out>, id=..., count=...) at /work/iree/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp:433
#12 0x0000000000b4677c in mlir::iree_compiler::distributeCyclicallyToProcessors<mlir::gpu::BlockIdOp, mlir::gpu::GridDimOp> (pLoopOp=..., rewriter=...) at /work/iree/third_party/llvm-project/mlir/include/mlir/IR/Operation.h:103
#13 mlir::iree_compiler::mapToWorkgroups (useCyclicDistribution=<optimized out>, pLoopOp=..., rewriter=...) at /work/iree/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp:484
#14 mlir::iree_compiler::(anonymous namespace)::PartitionPLoopToWorkgroups::matchAndRewrite (this=<optimized out>, pLoopOp=..., operands=..., rewriter=...) at /work/iree/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp:549
#15 0x0000000000e1cb68 in mlir::ConversionPattern::matchAndRewrite (this=0x4567cb0, op=0x44b42e0, rewriter=...) at /work/iree/third_party/llvm-project/llvm/include/llvm/ADT/SmallVector.h:173
#16 0x0000000000be7d8b in mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::RewritePattern const&, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::RewritePattern const&)>, llvm::function_ref<void (mlir::RewritePattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::RewritePattern const&)>) (this=this@entry=0x7fffffffc528, op=op@entry=0x44b42e0, pattern=..., rewriter=..., canApply=..., onFailure=..., onSuccess=...) at /work/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:21
#17 0x0000000000be7f8f in mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::RewritePattern const&)>, llvm::function_ref<void (mlir::RewritePattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::RewritePattern const&)>) (this=this@entry=0x7fffffffc528, op=0x44b42e0, rewriter=..., canApply=..., onFailure=..., onSuccess=...) at /work/iree/third_party/llvm-project/mlir/lib/IR/PatternMatch.cpp:266
#18 0x0000000000e2c8fa in (anonymous namespace)::OperationLegalizer::legalizeWithPattern (rewriter=..., op=<optimized out>, this=0x7fffffffc4c0) at /work/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLExtras.h:194
#19 (anonymous namespace)::OperationLegalizer::legalize (rewriter=..., op=0x44b42e0, this=0x7fffffffc4c0) at /work/iree/third_party/llvm-project/mlir/lib/Transforms/DialectConversion.cpp:1421
#20 (anonymous namespace)::OperationLegalizer::legalize (this=0x7fffffffc4c0, op=0x44b42e0, rewriter=...) at /work/iree/third_party/llvm-project/mlir/lib/Transforms/DialectConversion.cpp:1358
#21 0x0000000000e2d3d6 in (anonymous namespace)::OperationConverter::convert (op=<optimized out>, rewriter=..., this=0x7fffffffc4c0) at /work/iree/third_party/llvm-project/mlir/lib/Transforms/DialectConversion.cpp:1898
#22 (anonymous namespace)::OperationConverter::convertOperations (this=this@entry=0x7fffffffc4c0, ops=...) at /work/iree/third_party/llvm-project/mlir/lib/Transforms/DialectConversion.cpp:1943
#23 0x0000000000e2e2ab in mlir::applyFullConversion (ops=..., target=..., patterns=...) at /work/iree/third_party/llvm-project/mlir/lib/Transforms/DialectConversion.cpp:2350
#24 0x0000000000e2e3be in mlir::applyFullConversion (op=<optimized out>, target=..., patterns=...) at /work/iree/third_party/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:458
#25 0x0000000000b3ddee in mlir::iree_compiler::(anonymous namespace)::ConvertToGPUPass::runOnFunction (this=0x45510f0) at /work/iree/third_party/llvm-project/mlir/include/mlir/IR/OpDefinition.h:102
#2

Activity

  1. added 2 commits that reference this issue on Jul 19, 2020
    456b742
    e81cce1
  2. added a commit that references this issue on Jul 19, 2020
    5a51d2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions