Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple return values causes stack trace in secret-to-bgv #1316

Open
j2kun opened this issue Jan 27, 2025 · 0 comments
Open

Multiple return values causes stack trace in secret-to-bgv #1316

j2kun opened this issue Jan 27, 2025 · 0 comments
Labels
bug Something isn't working dialect: bgv Issues concerning the bgv dialect

Comments

@j2kun
Copy link
Collaborator

j2kun commented Jan 27, 2025

Even after fixing #1298 (comment), the example from that issue gives a stack trace in a later compiler pass in this pipeline

// RUN: heir-opt --mlir-to-bgv %s

func.func @foo(%x: i16 {secret.secret}, %y: i16 {secret.secret}) -> (i16, i16) {
  %0 = arith.addi %x, %y : i16
  return %0, %0: i16, i16
}

Stack trace (with assertion failure)

Trying to match "mlir::heir::SecretGenericOpCipherConversion<mlir::arith::AddIOp, mlir::heir::bgv::AddOp>"
heir-opt: bazel-out/k8-dbg/bin/lib/Dialect/BGV/IR/BGVOps.cpp.inc:161: static void mlir::heir::bgv::AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &, ::mlir::TypeRange, ::mlir::ValueRange, ::llvm::ArrayRef< ::mlir::NamedAttribute>): Assertion `resultTypes.size() == 1u && "mismatched number of return types"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/j2kun/.cache/bazel/_bazel_j2kun/b07a48cf9da8c73a462d3608e5c508dd/execroot/heir/bazel-out/k8-dbg/bin/tools/heir-opt --mlir-to-bgv --debug --mlir-print-ir-after-failure /home/j2kun/fhe/heir/tests/Transforms/optimize_relinearization/multiple_return_values.mlir
 #0 0x0000564e524143fd llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:796:11
 #1 0x0000564e524148eb PrintStackTraceSignalHandler(void*) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:872:1
 #2 0x0000564e52411fa6 llvm::sys::RunSignalHandlers() /proc/self/cwd/external/llvm-project/llvm/lib/Support/Signals.cpp:105:5
 #3 0x0000564e52414fe5 SignalHandler(int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f3b4c75a520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f3b4c7ae9fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007f3b4c7ae9fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007f3b4c7ae9fc pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007f3b4c75a476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007f3b4c7407f3 abort ./stdlib/abort.c:81:7
#10 0x00007f3b4c74071b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#11 0x00007f3b4c751e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#12 0x0000564e4d8e46cc mlir::heir::bgv::AddOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::TypeRange, mlir::ValueRange, llvm::ArrayRef<mlir::NamedAttribute>) /proc/self/cwd/bazel-out/k8-dbg/bin/lib/Dialect/BGV/IR/BGVOps.cpp.inc:162:3
#13 0x0000564e4bdc06a5 mlir::heir::bgv::AddOp mlir::OpBuilder::create<mlir::heir::bgv::AddOp, mlir::TypeRange&, mlir::ValueRange&>(mlir::Location, mlir::TypeRange&, mlir::ValueRange&) /proc/self/cwd/external/llvm-project/mlir/include/mlir/IR/Builders.h:518:5
#14 0x0000564e4bdbfe2a mlir::heir::bgv::AddOp mlir::RewriterBase::replaceOpWithNewOp<mlir::heir::bgv::AddOp, mlir::TypeRange&, mlir::ValueRange&>(mlir::Operation*, mlir::TypeRange&, mlir::ValueRange&) /proc/self/cwd/external/llvm-project/mlir/include/mlir/IR/PatternMatch.h:543:18
#15 0x0000564e4bdbee59 mlir::heir::SecretGenericOpCipherConversion<mlir::arith::AddIOp, mlir::heir::bgv::AddOp>::matchAndRewriteInner(mlir::heir::secret::GenericOp, mlir::TypeRange, mlir::ValueRange, llvm::ArrayRef<mlir::NamedAttribute>, mlir::ConversionPatternRewriter&) const /proc/self/cwd/./lib/Utils/ConversionUtils.h:277:14
#16 0x0000564e4bdbed2b mlir::heir::SecretGenericOpConversion<mlir::arith::AddIOp, mlir::heir::bgv::AddOp>::matchAndRewrite(mlir::heir::secret::GenericOp, mlir::heir::secret::GenericOpAdaptor, mlir::ConversionPatternRewriter&) const /proc/self/cwd/./lib/Utils/ConversionUtils.h:247:12
#17 0x0000564e4bbf6c8a mlir::OpConversionPattern<mlir::heir::secret::GenericOp>::matchAndRewrite(mlir::heir::secret::GenericOp, mlir::heir::secret::GenericOpGenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) const /proc/self/cwd/external/llvm-project/mlir/include/mlir/Transforms/DialectConversion.h:688:12
#18 0x0000564e4bbf68ca mlir::OpConversionPattern<mlir::heir::secret::GenericOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const /proc/self/cwd/external/llvm-project/mlir/include/mlir/Transforms/DialectConversion.h:656:12
#19 0x0000564e51928b56 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const /proc/self/cwd/external/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:1868:10
@j2kun j2kun added bug Something isn't working dialect: bgv Issues concerning the bgv dialect labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dialect: bgv Issues concerning the bgv dialect
Projects
None yet
Development

No branches or pull requests

1 participant