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

Repo sync #874

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def _yacl():
http_archive,
name = "yacl",
urls = [
"https://github.com/secretflow/yacl/archive/refs/tags/0.4.5b6_nightly_20240923.tar.gz",
"https://github.com/secretflow/yacl/archive/refs/tags/0.4.5b7_nightly_20240930.tar.gz",
],
strip_prefix = "yacl-0.4.5b6_nightly_20240923",
sha256 = "14eaaf7ad4aead7f2244e56453fead4a47973a020e23739ca0fe93873866bb5f",
strip_prefix = "yacl-0.4.5b7_nightly_20240930",
sha256 = "cf8dc7cceb9c5d05df00f1c086feec99d554db3e3cbe101253cf2a5a1adb9072",
)

def _libpsi():
Expand Down
19 changes: 19 additions & 0 deletions libspu/compiler/tests/interpret/dynamic_update_slice.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,22 @@ func.func @dynamic_update_slice() {
pphlo.custom_call @expect_eq (%result, %expected) : (tensor<4x4xi64>,tensor<4x4xi64>)->()
func.return
}

// -----

func.func @dynamic_update_slice() {
%operand = pphlo.constant dense<[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 2, 2, 2],
[1, 2, 2, 2]]> : tensor<4x4xi64>
%update = pphlo.constant dense<[[1, 1, 1],
[1, 1, 1]]> : tensor<2x3xi64>
%i0 = pphlo.constant dense<4> : tensor<i64>
%start_indices0 = pphlo.convert %i0 : (tensor<i64>) -> tensor<!pphlo.secret<i64>>
%start_indices1 = pphlo.constant dense<4> : tensor<i64>
%result = pphlo.dynamic_update_slice %operand, %update, %start_indices0, %start_indices1 :
(tensor<4x4xi64>, tensor<2x3xi64>, tensor<!pphlo.secret<i64>>, tensor<i64>) -> tensor<4x4x!pphlo.secret<i64>>
%expected = pphlo.constant dense<[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]> : tensor<4x4xi64>
pphlo.custom_call @expect_eq (%result, %expected) : (tensor<4x4x!pphlo.secret<i64>>, tensor<4x4xi64>)->()
func.return
}
3 changes: 0 additions & 3 deletions libspu/compiler/tools/spu-translate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
#include "libspu/compiler/core/core.h"
#undef EXPOSE_PIPELINE_BUILDER

template <typename T>
struct fmt::formatter<xt::xarray<T>> : ostream_formatter {};

llvm::cl::opt<uint32_t> ProtocolKind(
"protocol_kind", llvm::cl::init(1),
llvm::cl::desc("1 for REF2k, 2 for SEMI2k, 3 for ABY3, 4 for Cheetah"));
Expand Down
1 change: 0 additions & 1 deletion libspu/core/xt_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,3 @@ NdArrayRef xt_to_ndarray(const xt::xexpression<E>& e) {

template <typename T>
struct fmt::is_range<xt::xarray<T>, char> : std::false_type {};

15 changes: 9 additions & 6 deletions libspu/dialect/pphlo/IR/type_inference.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,16 @@ LogicalResult inferDynamicUpdateSliceOp(

// dynamic_update_slice_c1
TypeTools tools(operand.getContext());
auto common_vis =
tools.computeCommonVisibility({tools.getTypeVisibility(operandType),
tools.getTypeVisibility(updateType)});
auto vis = llvm::map_to_vector(startIndices, [&](mlir::Value v) {
return tools.getTypeVisibility(v.getType());
});
vis.emplace_back(tools.getTypeVisibility(operand.getType()));
vis.emplace_back(tools.getTypeVisibility(update.getType()));

inferredReturnTypes.emplace_back(RankedTensorType::get(
operandType.getShape(),
tools.getType(operandType.getElementType(), common_vis)));
inferredReturnTypes.emplace_back(
RankedTensorType::get(operandType.getShape(),
tools.getType(operandType.getElementType(),
tools.computeCommonVisibility(vis))));
return success();
}

Expand Down
Loading
Loading