Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/Pipelines/ArithmeticPipelineRegistration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void mlirToSecretArithmeticPipelineBuilder(

// Vectorize and optimize rotations
// TODO(#2320): figure out where this fits in the new pipeline
hecoSIMDVectorizerPipelineBuilder(pm, options.experimentalDisableLoopUnroll);
hecoSIMDVectorizerPipelineBuilder(pm, !options.unrollFheKernelLoops);
mathToPolynomialApproximationBuilder(pm, options.useCompositeRelu);

// Layout assignment and optimization
Expand All @@ -223,7 +223,7 @@ void mlirToSecretArithmeticPipelineBuilder(
ConvertToCiphertextSemanticsOptions convertToCiphertextSemanticsOptions;
convertToCiphertextSemanticsOptions.minSlotCount = options.minSlotCount;
convertToCiphertextSemanticsOptions.unrollKernels =
!options.experimentalDisableLoopUnroll;
options.unrollFheKernelLoops;
convertToCiphertextSemanticsOptions.codegenStrategy = options.codegenStrategy;
pm.addPass(
createConvertToCiphertextSemantics(convertToCiphertextSemanticsOptions));
Expand Down Expand Up @@ -254,6 +254,7 @@ void mlirToPlaintextPipelineBuilder(OpPassManager& pm,
// Convert to secret arithmetic
MlirToRLWEPipelineOptions mlirToRLWEPipelineOptions;
mlirToRLWEPipelineOptions.minSlotCount = options.plaintextSize;
mlirToRLWEPipelineOptions.unrollFheKernelLoops = options.unrollFheKernelLoops;
mlirToSecretArithmeticPipelineBuilder(pm, mlirToRLWEPipelineOptions);

// Insert debug handler calls and/or lower debug.validate
Expand Down Expand Up @@ -429,7 +430,7 @@ void mlirToRLWEPipeline(OpPassManager& pm,
}

// TODO(#2600): support loops in optimize-relinearization
if (!options.experimentalDisableLoopUnroll) {
if (options.unrollFheKernelLoops) {
OptimizeRelinearizationOptions optimizeRelinearizationOptions;
optimizeRelinearizationOptions.allowMixedDegreeOperands = false;
pm.addPass(createOptimizeRelinearization(optimizeRelinearizationOptions));
Expand Down Expand Up @@ -731,8 +732,7 @@ void torchLinalgToCkksBuilder(OpPassManager& manager,
suboptions.scalingModBits = options.scalingModBits;
suboptions.firstModBits = options.firstModBits;
suboptions.enableSplitPreprocessing = options.enableSplitPreprocessing;
suboptions.experimentalDisableLoopUnroll =
options.experimentalDisableLoopUnroll;
suboptions.unrollFheKernelLoops = options.unrollFheKernelLoops;
suboptions.usePublicKey = options.usePublicKey;
suboptions.encryptionTechniqueExtended = options.encryptionTechniqueExtended;
suboptions.greedyModulusSwitchAfterMul = options.greedyModulusSwitchAfterMul;
Expand Down
10 changes: 7 additions & 3 deletions lib/Pipelines/ArithmeticPipelineRegistration.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ enum RLWEScheme { ckksScheme, bgvScheme, bfvScheme };
enum CiphertextManagementStyle { greedy, orbitIlp };

struct LoopOptions : public PassPipelineOptions<LoopOptions> {
PassOptions::Option<bool> experimentalDisableLoopUnroll{
*this, "experimental-disable-loop-unroll",
llvm::cl::desc("Experimental: disable loop unroll, may break analyses "
PassOptions::Option<bool> unrollFheKernelLoops{
*this, "unroll-fhe-kernel-loops",
llvm::cl::desc("Unroll FHE kernel loops "
"(default to false)"),
llvm::cl::init(false)};
};
Expand Down Expand Up @@ -191,6 +191,10 @@ struct PlaintextBackendOptions
llvm::cl::desc("The size of the plaintexts; i.e., the number of slots "
"to use for packing."),
llvm::cl::init(1024)};
PassOptions::Option<bool> unrollFheKernelLoops{
*this, "unroll-fhe-kernel-loops",
llvm::cl::desc("Unroll FHE kernel loops (default to false)"),
llvm::cl::init(false)};
};

struct BackendOptions : public PassPipelineOptions<BackendOptions> {
Expand Down
4 changes: 3 additions & 1 deletion tests/Dialect/Openfhe/Transforms/eval_add_count.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// RUN: heir-opt --mlir-to-secret-arithmetic --secret-insert-mgmt-bgv --openfhe-count-add-and-key-switch %s | FileCheck %s
// TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
// does not support dynamic extraction indices from ciphertexts.
// RUN: heir-opt --mlir-to-secret-arithmetic='unroll-fhe-kernel-loops=true' --secret-insert-mgmt-bgv --openfhe-count-add-and-key-switch %s | FileCheck %s

// CHECK: #mgmt.openfhe_params<
// CHECK-SAME: evalAddCount = 8
Expand Down
4 changes: 3 additions & 1 deletion tests/Examples/lattigo/bgv/box_blur/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ load("@rules_go//go:def.bzl", "go_test")

package(default_applicable_licenses = ["@heir//:license"])

# TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
# does not support dynamic extraction indices from ciphertexts.
heir_lattigo_lib(
name = "box_blur",
go_library_name = "boxblur",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=bgv",
"--mlir-to-bgv=plaintext-modulus=786433 min-slot-count=2048",
"--mlir-to-bgv=plaintext-modulus=786433 min-slot-count=2048 unroll-fhe-kernel-loops=true",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:box_blur_16x16.mlir",
Expand Down
4 changes: 3 additions & 1 deletion tests/Examples/lattigo/bgv/roberts_cross/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ load("@rules_go//go:def.bzl", "go_test")

package(default_applicable_licenses = ["@heir//:license"])

# TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
# does not support dynamic extraction indices from ciphertexts.
heir_lattigo_lib(
name = "roberts_cross",
go_library_name = "robertscross",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=bgv",
"--mlir-to-bgv=min-slot-count=4096 plaintext-modulus=536903681",
"--mlir-to-bgv=min-slot-count=4096 plaintext-modulus=536903681 unroll-fhe-kernel-loops=true",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:roberts_cross_16x16.mlir",
Expand Down
4 changes: 3 additions & 1 deletion tests/Examples/lattigo/bgv/simple_sum/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ go_test(
# For Google-internal reasons we must separate the go_test rules from the macro
# above.

# TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
# does not support dynamic extraction indices from ciphertexts.
heir_lattigo_lib(
name = "simple_sum",
go_library_name = "simplesum",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=bgv",
"--mlir-to-bgv=min-slot-count=1024",
"--mlir-to-bgv=min-slot-count=1024 unroll-fhe-kernel-loops=true",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:simple_sum.mlir",
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/batch_matmul/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ heir_lattigo_lib(
go_library_name = "batchmatmul",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--mlir-to-ckks=min-slot-count=4096 experimental-disable-loop-unroll=true greedy-level-budget=40 first-mod-bits=60 scaling-mod-bits=50",
"--mlir-to-ckks=min-slot-count=4096 unroll-fhe-kernel-loops=false greedy-level-budget=40 first-mod-bits=60 scaling-mod-bits=50",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:batch_matmul.mlir",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ func TestConv1DDilated(t *testing.T) {
}

ct0 := Conv1d_dilated__encrypt__arg0(evaluator, params, ecd, enc, arg0)
ctZero := Conv1d_dilated__encrypt__zero__0(evaluator, params, ecd, enc)

startPre := time.Now()
filterPlains := conv1d_dilated_utils.Conv1d_dilated__preprocessing(params, ecd)
t.Logf("Preprocessing took %s", time.Since(startPre))

start := time.Now()
resultCt := Conv1d_dilated__preprocessed(evaluator, params, ecd, ct0, filterPlains)
resultCt := Conv1d_dilated__preprocessed(evaluator, params, ecd, ct0, ctZero, filterPlains)
t.Logf("Conv1d_dilated (preprocessed) took %s", time.Since(start))

result := Conv1d_dilated__decrypt__result0(evaluator, params, ecd, dec, resultCt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "conv1dncwchannelpadding",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--mlir-to-ckks=min-slot-count=1024 experimental-disable-loop-unroll=true",
"--mlir-to-ckks=min-slot-count=1024 unroll-fhe-kernel-loops=false",
"--scheme-to-lattigo",
],
mlir_src = "conv1d_ncw_channel_padding.mlir",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func TestConv1DPadded(t *testing.T) {
}

ct0 := Conv1d_ncw_padded__encrypt__arg0(evaluator, params, ecd, enc, arg0)
resultCt := Conv1d_ncw_padded(evaluator, params, ecd, ct0)
ctZero := Conv1d_ncw_padded__encrypt__zero__0(evaluator, params, ecd, enc)
resultCt := Conv1d_ncw_padded(evaluator, params, ecd, ct0, ctZero)
result := Conv1d_ncw_padded__decrypt__result0(evaluator, params, ecd, dec, resultCt)
errorThreshold := float64(0.05)
for i := range expected {
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/conv2d_dilated/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "conv2d_dilated",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--torch-linalg-to-ckks=min-slot-count=1024 scaling-mod-bits=45 first-mod-bits=60 experimental-disable-loop-unroll=true",
"--torch-linalg-to-ckks=min-slot-count=1024 scaling-mod-bits=45 first-mod-bits=60 unroll-fhe-kernel-loops=false",
"--scheme-to-lattigo",
],
mlir_src = "conv2d_dilated.mlir",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ func TestConv2dChain(t *testing.T) {
expected := conv2dNchwFchw(out1, filter2, 1, 1, 3, 3, 1, 2, 1, 1, 1, 0, 0)

ct0 := Conv2d_chain__encrypt__arg0(evaluator, params, ecd, enc, arg0)
ctZero0 := Conv2d_chain__encrypt__zero__0(evaluator, params, ecd, enc)
ctZero1 := Conv2d_chain__encrypt__zero__1(evaluator, params, ecd, enc)
startPre := time.Now()
filterPlains := conv2dnchwchain_utils.Conv2d_chain__preprocessing(params, ecd)
t.Logf("Preprocessing took %s", time.Since(startPre))
start := time.Now()
resultCt := Conv2d_chain__preprocessed(evaluator, params, ecd, ct0, filterPlains)
resultCt := Conv2d_chain__preprocessed(evaluator, params, ecd, ct0, ctZero0, ctZero1, filterPlains)
t.Logf("Conv2d chain (preprocessed) took %s", time.Since(start))
result := Conv2d_chain__decrypt__result0(evaluator, params, ecd, dec, resultCt)
errorThreshold := float64(0.01)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ func TestConv2dChannelPadding(t *testing.T) {
expected := conv2dNchwFchw(arg0, filter, 1, 1, 4, 4, 3, 2, 2, 2, 2)

ct0 := Conv2d_channel_pad__encrypt__arg0(evaluator, params, ecd, enc, arg0)
ctZero := Conv2d_channel_pad__encrypt__zero__0(evaluator, params, ecd, enc)
startPre := time.Now()
filterPlains := conv2dnchwchannelpadding_utils.Conv2d_channel_pad__preprocessing(params, ecd)
t.Logf("Preprocessing took %s", time.Since(startPre))
start := time.Now()
resultCt := Conv2d_channel_pad__preprocessed(evaluator, params, ecd, ct0, filterPlains)
resultCt := Conv2d_channel_pad__preprocessed(evaluator, params, ecd, ct0, ctZero, filterPlains)
t.Logf("Conv2d (preprocessed) took %s", time.Since(start))
result := Conv2d_channel_pad__decrypt__result0(evaluator, params, ecd, dec, resultCt)

Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/conv2d_nchw_padded/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "conv2dnchwpadded",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--mlir-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true experimental-disable-loop-unroll=true",
"--mlir-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true unroll-fhe-kernel-loops=false",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:conv2d_nchw_padded.mlir",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func TestConv2D(t *testing.T) {
}

ct0 := Conv2d_nchw__encrypt__arg0(evaluator, params, ecd, enc, arg0)
resultCt := Conv2d_nchw(evaluator, params, ecd, ct0)
ctZero := Conv2d_nchw__encrypt__zero__0(evaluator, params, ecd, enc)
resultCt := Conv2d_nchw(evaluator, params, ecd, ct0, ctZero)
result := Conv2d_nchw__decrypt__result0(evaluator, params, ecd, dec, resultCt)
errorThreshold := float64(0.5)
for i := 0; i < 32; i++ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func TestConv2D(t *testing.T) {
}

ct0 := Conv2d_nchw__encrypt__arg0(evaluator, params, ecd, enc, arg0)
resultCt := Conv2d_nchw(evaluator, params, ecd, ct0)
ctZero := Conv2d_nchw__encrypt__zero__0(evaluator, params, ecd, enc)
resultCt := Conv2d_nchw(evaluator, params, ecd, ct0, ctZero)
result := Conv2d_nchw__decrypt__result0(evaluator, params, ecd, dec, resultCt)
errorThreshold := float64(0.5)
for i := 0; i < 128; i++ {
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/conv_pool_fusion/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "conv_pool_fusion",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--torch-linalg-to-ckks=min-slot-count=4096 greedy-modulus-switch-after-mul=true experimental-disable-loop-unroll=true",
"--torch-linalg-to-ckks=min-slot-count=4096 greedy-modulus-switch-after-mul=true unroll-fhe-kernel-loops=false",
"--scheme-to-lattigo",
],
mlir_src = "conv_pool_fusion.mlir",
Expand Down
5 changes: 4 additions & 1 deletion tests/Examples/lattigo/ckks/lola/lola_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@ func TestLoLA(t *testing.T) {
}

ct0 := Lola__encrypt__arg0(evaluator, params, ecd, enc, arg0)
ctZero0 := Lola__encrypt__zero__0(evaluator, params, ecd, enc)
ctZero1 := Lola__encrypt__zero__1(evaluator, params, ecd, enc)
ctZero2 := Lola__encrypt__zero__2(evaluator, params, ecd, enc)

// The embedded constant weights are encoded into plaintexts once, up front.
startPre := time.Now()
weightPlains := lola_utils.Lola__preprocessing(params, ecd)
t.Logf("Lola__preprocessing took %s", time.Since(startPre))

start := time.Now()
resultCt := Lola__preprocessed(evaluator, params, ecd, ct0, weightPlains)
resultCt := Lola__preprocessed(evaluator, params, ecd, ct0, ctZero0, ctZero1, ctZero2, weightPlains)
Comment thread
AlexanderViand marked this conversation as resolved.
t.Logf("Lola__preprocessed took %s", time.Since(start))

result := Lola__decrypt__result0(evaluator, params, ecd, dec, resultCt)
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/matvec_512x784/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "matvec512x784",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--mlir-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true experimental-disable-loop-unroll=true greedy-level-budget=40 first-mod-bits=55",
"--mlir-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true unroll-fhe-kernel-loops=false greedy-level-budget=40 first-mod-bits=55",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:matvec_512x784.mlir",
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/matvec_square/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "matvec512x512",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--mlir-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true experimental-disable-loop-unroll=true greedy-level-budget=40 first-mod-bits=55",
"--mlir-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true unroll-fhe-kernel-loops=false greedy-level-budget=40 first-mod-bits=55",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common:matvec_512x512.mlir",
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/lattigo/ckks/mnist/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heir_lattigo_lib(
go_library_name = "mnist",
heir_opt_flags = [
"--annotate-module=backend=lattigo scheme=ckks",
"--torch-linalg-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true experimental-disable-loop-unroll=true greedy-level-budget=40 first-mod-bits=55",
"--torch-linalg-to-ckks=min-slot-count=1024 greedy-modulus-switch-after-mul=true unroll-fhe-kernel-loops=false greedy-level-budget=40 first-mod-bits=55",
"--scheme-to-lattigo",
],
mlir_src = "@heir//tests/Examples/common/mnist:mnist.mlir",
Expand Down
3 changes: 2 additions & 1 deletion tests/Examples/lattigo/ckks/pooling/pooling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ func TestPooling(t *testing.T) {
}

ct0 := Pooling__encrypt__arg0(evaluator, params, ecd, enc, arg0)
ctZero := Pooling__encrypt__zero__0(evaluator, params, ecd, enc)

startPre := time.Now()
filterPlains := pooling_utils.Pooling__preprocessing(params, ecd)
t.Logf("Preprocessing took %s", time.Since(startPre))

start := time.Now()
resultCt := Pooling__preprocessed(evaluator, params, ecd, ct0, filterPlains)
resultCt := Pooling__preprocessed(evaluator, params, ecd, ct0, ctZero, filterPlains)
t.Logf("Pooling (preprocessed) took %s", time.Since(start))

result := Pooling__decrypt__result0(evaluator, params, ecd, dec, resultCt)
Expand Down
3 changes: 2 additions & 1 deletion tests/Examples/lattigo/ckks/pooling1d/pooling1d_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ func TestPooling(t *testing.T) {
}

ct0 := Pooling1d__encrypt__arg0(evaluator, params, ecd, enc, arg0)
ctZero := Pooling1d__encrypt__zero__0(evaluator, params, ecd, enc)

startPre := time.Now()
filterPlains := pooling1d_utils.Pooling1d__preprocessing(params, ecd)
t.Logf("Preprocessing took %s", time.Since(startPre))

start := time.Now()
resultCt := Pooling1d__preprocessed(evaluator, params, ecd, ct0, filterPlains)
resultCt := Pooling1d__preprocessed(evaluator, params, ecd, ct0, ctZero, filterPlains)
t.Logf("Pooling1d (preprocessed) took %s", time.Since(start))

result := Pooling1d__decrypt__result0(evaluator, params, ecd, dec, resultCt)
Expand Down
4 changes: 3 additions & 1 deletion tests/Examples/openfhe/bgv/box_blur/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ load("@heir//tests/Examples/openfhe:test.bzl", "openfhe_end_to_end_test")

package(default_applicable_licenses = ["@heir//:license"])

# TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
# does not support dynamic extraction indices from ciphertexts.
openfhe_end_to_end_test(
name = "box_blur_16x16_test",
generated_lib_header = "box_blur_16x16_lib.h",
heir_opt_flags = [
"--annotate-module=backend=openfhe scheme=bgv",
"--mlir-to-bgv=plaintext-modulus=786433",
"--mlir-to-bgv=plaintext-modulus=786433 unroll-fhe-kernel-loops=true",
"--scheme-to-openfhe",
],
mlir_src = "@heir//tests/Examples/common:box_blur_16x16.mlir",
Expand Down
4 changes: 3 additions & 1 deletion tests/Examples/openfhe/bgv/roberts_cross/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ load("@heir//tests/Examples/openfhe:test.bzl", "openfhe_end_to_end_test")

package(default_applicable_licenses = ["@heir//:license"])

# TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
# does not support dynamic extraction indices from ciphertexts.
openfhe_end_to_end_test(
name = "roberts_cross_16x16_test",
generated_lib_header = "roberts_cross_16x16_lib.h",
heir_opt_flags = [
"--annotate-module=backend=openfhe scheme=bgv",
"--mlir-to-bgv=min-slot-count=4096 plaintext-modulus=536903681",
"--mlir-to-bgv=min-slot-count=4096 plaintext-modulus=536903681 unroll-fhe-kernel-loops=true",
"--scheme-to-openfhe",
],
mlir_src = "@heir//tests/Examples/common:roberts_cross_16x16.mlir",
Expand Down
4 changes: 3 additions & 1 deletion tests/Examples/openfhe/bgv/simple_sum/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ load("@heir//tests/Examples/openfhe:test.bzl", "openfhe_end_to_end_test")

package(default_applicable_licenses = ["@heir//:license"])

# TODO(#2257): Loop unrolling is required because convert-to-ciphertext-semantics
# does not support dynamic extraction indices from ciphertexts.
openfhe_end_to_end_test(
name = "simple_sum_test",
generated_lib_header = "simple_sum_lib.h",
heir_opt_flags = [
"--annotate-module=backend=openfhe scheme=bgv",
"--mlir-to-bgv=min-slot-count=8192",
"--mlir-to-bgv=min-slot-count=8192 unroll-fhe-kernel-loops=true",
"--scheme-to-openfhe",
],
mlir_src = "@heir//tests/Examples/common:simple_sum.mlir",
Expand Down
2 changes: 1 addition & 1 deletion tests/Examples/openfhe/ckks/batch_matmul/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ openfhe_end_to_end_test(
generated_lib_header = "batch_matmul_lib.h",
heir_opt_flags = [
"--annotate-module=backend=openfhe scheme=ckks",
"--mlir-to-ckks=min-slot-count=4096 experimental-disable-loop-unroll=true greedy-level-budget=10 first-mod-bits=60 scaling-mod-bits=50",
"--mlir-to-ckks=min-slot-count=4096 unroll-fhe-kernel-loops=false greedy-level-budget=10 first-mod-bits=60 scaling-mod-bits=50",
"--scheme-to-openfhe",
],
mlir_src = "@heir//tests/Examples/common:batch_matmul.mlir",
Expand Down
3 changes: 2 additions & 1 deletion tests/Examples/openfhe/ckks/conv_1d/conv_1d_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ TEST(Conv1DTest, RunTest) {

auto ctEncrypted =
conv_1d__encrypt__arg0(cryptoContext, m, keyPair.publicKey);
auto ctZero = conv_1d__encrypt__zero__0(cryptoContext, keyPair.publicKey);

auto result = conv_1d(cryptoContext, ctEncrypted, filter);
auto result = conv_1d(cryptoContext, ctEncrypted, filter, ctZero);

auto actual =
conv_1d__decrypt__result0(cryptoContext, result, keyPair.secretKey);
Expand Down
Loading
Loading