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-2025-01-08T19:18:51+0800 #962

Merged
merged 4 commits into from
Jan 8, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore spulib module
src/
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ build --copt=-fstack-protector-strong
build:linux --copt=-Wl,-z,noexecstack
build:macos --copt=-Wa,--noexecstack


build --keep_going
test --test_output=errors

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ _build
# bazel
/bazel-*
MODULE.bazel.lock
src/bazel-*
src/MODULE.bazel.lock

# cmake related
abseil-cpp
5 changes: 3 additions & 2 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ header: # <1>
- '**/*.mlir'
- '**/*.csv'
- '**/*.tmpl'
- 'libspu/compiler/tests/interpret/template/**.template'
- 'src/libspu/compiler/tests/interpret/template/**.template'
- 'LICENSE'
- 'NOTICE'
- 'MODULE.bazel.lock'
@@ -51,7 +51,8 @@ header: # <1>
- '.gitignore'
- '.gitmodules'
- 'pyproject.toml'
- 'libspu/core/half.h' # MIT
- 'src/libspu/core/half.h' # MIT
- '.bazelignore'

comment: never # <9>

26 changes: 24 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ The compiler portion of the project follows [MLIR style](https://mlir.llvm.org/g

### Prerequisite


#### Docker

```sh
@@ -49,8 +50,8 @@ docker run -d -it --name spu-dev-$(whoami) \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
--cap-add=NET_ADMIN \
--privileged=true \
--entrypoint="bash" \
secretflow/ubuntu-base-ci:latest
secretflow/ubuntu-base-ci:latest \
bash

# attach to build container
docker exec -it spu-dev-$(whoami) bash
@@ -87,7 +88,28 @@ brew install nasm

### Build & UnitTest




``` sh
####################################################
# build and test spu python bindings and applicatons
####################################################
# build as debug
bazel build //... -c dbg

# build as release
bazel build //... -c opt

# test
bazel test //...


############################################
# build and test spu core c++ implementation
############################################
cd src

# build as debug
bazel build //... -c dbg

97 changes: 34 additions & 63 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -20,12 +20,26 @@
###############################################################################

module(
name = "spulib",
version = "0.9.4.dev20250106",
name = "spu",
version = "0.9.4.dev20250108",
compatibility_level = 1,
)

bazel_dep(name = "grpc")
bazel_dep(name = "spulib")
local_path_override(
module_name = "spulib",
path = "src",
)

bazel_dep(name = "psi")
git_override(
module_name = "psi",
commit = "8ead92f1bb10329c7e7e56d541fecb3dcd47ee03",
remote = "https://github.com/secretflow/psi.git",
)

bazel_dep(name = "yacl", version = "20241212.0-871832a")
bazel_dep(name = "grpc", version = "1.66.0.bcr.3")
single_version_override(
module_name = "grpc",
patch_strip = 1,
@@ -46,20 +60,28 @@ single_version_override(
version = "27.3",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "apple_support", version = "1.17.1")
bazel_dep(name = "rules_cc", version = "0.0.12")
bazel_dep(name = "rules_cuda", version = "0.2.3")
bazel_dep(name = "rules_foreign_cc", version = "0.12.0")
bazel_dep(name = "bazel_features", version = "1.20.0")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
bazel_dep(name = "rules_cuda", version = "0.2.3")
bazel_dep(name = "rules_python", version = "0.29.0")
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
bazel_dep(name = "rules_proto_grpc_python", version = "5.0.0")

# For experimental/squirrel and examples/cpp
bazel_dep(name = "eigen", version = "3.4.90-20230801-66e8f3")
bazel_dep(name = "seal", version = "4.1.1")
bazel_dep(name = "spdlog", version = "1.14.1")
bazel_dep(name = "fmt", version = "11.0.2")
bazel_dep(name = "abseil-cpp", version = "20240722.0")
bazel_dep(name = "llvm-raw", version = "20240809.0-35f55f5")

llvm = use_extension("@llvm-raw//utils/bazel:extension.bzl", "llvm")
llvm.configure(
targets = [
"AArch64",
"X86",
"ARM",
],
)
use_repo(llvm, "llvm-project")
# END for experimental/squirrel and examples/cpp

DEFAULT_PYTHON_VERSION = "3.11"

@@ -111,56 +133,5 @@ pip.override(
)
use_repo(pip, "spu_pip_dev")

# --registry=https://baidu.github.io/babylon/registry
bazel_dep(name = "leveldb", version = "1.23")

# self-hosted registry
bazel_dep(name = "eigen", version = "3.4.90-20230801-66e8f3")
bazel_dep(name = "emp-tool", version = "0.2.5")
bazel_dep(name = "emp-ot", version = "0.2.4")
bazel_dep(name = "brpc", version = "1.11.0-20241212-282bc90")
bazel_dep(name = "seal", version = "4.1.1")
bazel_dep(name = "cutlass", version = "3.5.1")
bazel_dep(name = "llvm-raw", version = "20240809.0-35f55f5")
bazel_dep(name = "sse2neon", version = "1.7.0-20240330-8df2f48")

llvm = use_extension("@llvm-raw//utils/bazel:extension.bzl", "llvm")
llvm.configure(
targets = [
"AArch64",
"X86",
"ARM",
],
)
use_repo(llvm, "llvm-project")

bazel_dep(name = "stablehlo", version = "20240808.0-24d1807")
bazel_dep(name = "xla", version = "20240814.0-64bdcc5")
bazel_dep(name = "yacl", version = "20241212.0-871832a")
bazel_dep(name = "psi")
git_override(
module_name = "psi",
commit = "8ead92f1bb10329c7e7e56d541fecb3dcd47ee03",
remote = "https://github.com/secretflow/psi.git",
)

spu_dependencies = use_extension("//bazel:defs.bzl", "non_module_dependencies")
use_repo(spu_dependencies, "xtensor")

new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

new_local_repository(
name = "macos_omp_x64",
build_file = "@yacl//bazel:local_openmp_macos.BUILD",
path = "/usr/local/opt/libomp",
)

new_local_repository(
name = "macos_omp_arm64",
build_file = "@yacl//bazel:local_openmp_macos.BUILD",
path = "/opt/homebrew/opt/libomp/",
)

# test
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
bazel_dep(name = "google_benchmark", version = "1.8.5", dev_dependency = True)
28 changes: 14 additions & 14 deletions REPO_LAYOUT.md
Original file line number Diff line number Diff line change
@@ -7,26 +7,26 @@ This is a high level overview of how the repository is laid out. Some major fold
* [bazel/](bazel/): Configuration for SPU's use of [Bazel](https://bazel.build/).
* [docs/](docs/): Documents of SPU.
* [examples/](examples/): Contains both cpp and python examples of SPU.
* [libspu/](libspu/): Core C++ implementations of SPU.
* [compiler/](libspu/compiler/): SPU's compiler stack. It accepts the standard XLA IR along with
* [src/libspu/](src/libspu/): Core C++ implementations of SPU.
* [compiler/](src/libspu/compiler/): SPU's compiler stack. It accepts the standard XLA IR along with
inputs mpc metadata and lowering the XLA IR to an mpc specific IR.
* [core/](libspu/core/): Basic data structures used in SPU.
* [device/](libspu/device/): SPU device `Runtime`. It consists of IO(infeed, outfeed),
* [core/](src/libspu/core/): Basic data structures used in SPU.
* [device/](src/libspu/device/): SPU device `Runtime`. It consists of IO(infeed, outfeed),
symbol tables(storage) and the IR executor.
* [dialect/](libspu/dialect/): Internal MPC-specific IR used by SPU.
* [kernel/](libspu/kernel/): SPU runtime kernels.
* [hlo/](libspu/kernel/hlo/): High level operations, which match the definition of pphlo.
* [hal/](libspu/kernel/hal/): Hardware abstraction layer which implements crypto-independent core
* [dialect/](src/libspu/dialect/): Internal MPC-specific IR used by SPU.
* [kernel/](src/libspu/kernel/): SPU runtime kernels.
* [hlo/](src/libspu/kernel/hlo/): High level operations, which match the definition of pphlo.
* [hal/](src/libspu/kernel/hal/): Hardware abstraction layer which implements crypto-independent core
logics, fixed-point related abstractions and some non-linear APIs.
It could be viewed as a builtin library in addition to the SPU VM.
* [mpc/](libspu/mpc/): Various mpc protocols. This folder defines the [standard interface](libspu/mpc/apis.h)
* [mpc/](src/libspu/mpc/): Various mpc protocols. This folder defines the [standard interface](src/libspu/mpc/apis.h)
different mpc protocols need to conform.
* [aby3/](libspu/mpc/aby3/): The semi-honest variant of ABY3 protocol.
* [aby3/](src/libspu/mpc/aby3/): The semi-honest variant of ABY3 protocol.
Currently only `Arithmetic` and `Boolean` are implemented.
* [cheetah/](libspu/mpc/cheetah/): An excellent semi-honest 2PC protocol implemented by [Alibaba-Gemini-Lab](https://alibaba-gemini-lab.github.io/).
* [semi2k/](libspu/mpc/semi2k/): The semi-honest variant of SPDZ protocol.
* [cheetah/](src/libspu/mpc/cheetah/): An excellent semi-honest 2PC protocol implemented by [Alibaba-Gemini-Lab](https://alibaba-gemini-lab.github.io/).
* [semi2k/](src/libspu/mpc/semi2k/): The semi-honest variant of SPDZ protocol.
It could be shipped with different correlated random generators.
* [ref2k/](libspu/mpc/ref2k/): A plaintext protocol. It is aimed to serve as a reference implementation
* [ref2k/](src/libspu/mpc/ref2k/): A plaintext protocol. It is aimed to serve as a reference implementation
of how a new protocol could be added in SPU.
* [util/](libspu/mpc/utils/): Common utilities for different mpc protocols.
* [util/](src/libspu/mpc/utils/): Common utilities for different mpc protocols.
* [spu/](spu/): Python binding of libspu.
20 changes: 0 additions & 20 deletions bazel/patches/grpc-1.66.patch

This file was deleted.

1 change: 1 addition & 0 deletions bazel/patches/grpc-1.66.patch
13 changes: 0 additions & 13 deletions bazel/patches/grpc-module-file.patch

This file was deleted.

1 change: 1 addition & 0 deletions bazel/patches/grpc-module-file.patch
Loading