Commit Graph

349 Commits

Author SHA1 Message Date
youben11
e73291abdc chore: rename compiler to concrete-compiler
zamalang => concretelang
zamacompiler => concretecompiler
2021-12-29 15:13:34 +01:00
youben11
971cb56182 chore: licensing 2021-12-29 15:13:34 +01:00
rudy
48197d55ac feat(stress-tests): stress tests first case
Resolves #330
2021-12-28 09:03:38 +01:00
rudy
cdffb0ec8e fix(tests): CompileAndRunWithPrecision(6, 7 bits), more retries 2021-12-27 16:58:45 +01:00
rudy
d8fee32cea feat(HLFHELinalg): add apply_mapped_table_lookup
Resolves #182
2021-12-27 15:34:33 +01:00
Mayeul@Zama
81189ceaa9 fix .gitignore 2021-12-27 09:55:57 +01:00
aquint-zama
7f88d6553e docs: add first documentation 2021-12-27 09:55:57 +01:00
Antoniu Pop
a1a694a686 test(compiler): add unit tests for dataflow auto parallelization. 2021-12-23 15:57:53 +00:00
Antoniu Pop
cdca7ca6f7 feat(compiler): add Dataflow/RT dialect and code generation for dataflow auto parallelization. 2021-12-23 15:57:53 +00:00
Quentin Bourgerie
db683f4a0e feat(compiler/runtime): Introduce a RT dialect 2021-12-23 15:57:53 +00:00
Antoniu Pop
bc3d647453 fix(dfr): make HPX runtime environment persistent and deallocate temporaries. 2021-12-23 15:57:53 +00:00
Antoniu Pop
23d3dca3f2 formatting(dfr): add .hpp to the formatting script and format the relevant files. 2021-12-23 15:57:53 +00:00
Antoniu Pop
2cba686c66 fix(runtime): enable concurrent key usage by cloning it on get operation. 2021-12-23 15:57:53 +00:00
Antoniu Pop
e429180179 fix(ci): enable key caching for DF testing. 2021-12-22 18:22:22 +01:00
youben11
a32d73fb4e test(ci): test final python packages after release 2021-12-22 18:22:22 +01:00
youben11
62b417a373 refactor(ci): unify workflows into a single one
Having a single workflow make it easier to have dependencies between
jobs, like release and docker image being dependant of the tests job
2021-12-22 18:22:22 +01:00
rudy
5ed2dcb3c1 fix(compiler): MANP segfault bug in case of missing MANP value 2021-12-20 10:40:58 +01:00
rudy
7a286ba9f9 fix(KeySetCache): handle concurrent generation
Resolves #305
2021-12-20 10:07:48 +01:00
Andi Drebes
68e124964c test(compiler): Add tests for the HLFHELinalg tiling passes 2021-12-17 16:48:00 +01:00
Andi Drebes
7010a509d2 feat(compiler): Add option --hlfhelinalg-tile-sizes for global HLFHELinalg tile sizes
Add a new option --hlfhelinalg-tile-sizes that forces tiling of
HLFHELinalg operations and that sets the tile sizes to the sizes given
in the parameter. The specification of the tile sizes is a
comma-separated list of integers, e.g.,

  --hlfhelinalg-tile-sizes=2,2,2

forces to use tiles of size 2 in each dimension.
2021-12-17 16:09:59 +01:00
Andi Drebes
f319ba37d2 feat(compiler): Integrate HLFHELinalg tiling passes into compilation pipeline 2021-12-17 16:09:59 +01:00
Andi Drebes
bc75831c86 feat(compiler): Add passes for tiling of HLFHELinalg.matmul_eint_int
Add two passes related to the tiling of `HLFHELinalg.matmul_eint_int`
operations.

The `HLFHELinalgTilingMarker` pass takes a vector of tile sizes and
adds an integer array attribute "tile-sizes" to each instance of
`HLFHELinalg.matmul_eint_int`, e.g.,

  "HLFHELinalg.matmul_eint_int"(%arg0, %arg1) {"tile-sizes" = [2, 2, 2]} :
    (tensor<4x2x!HLFHE.eint<6>>, tensor<2x2xi7>) -> tensor<4x2x!HLFHE.eint<6>>

The `HLFHELinalgTiling` performs the actual tiling of each
`HLFHELinalg.matmul_eint_int` operation marked with a "tile-sizes"
attribute. The tiling preserves the level of abstraction of
HLFHELinalg and is implemented as a perfect loop nest of SCF for loops
with a `HLFHELinalg.matmul_eint_int` in the body.

For example,

  func @main(%arg0: tensor<4x2x!HLFHE.eint<6>>, %arg1: tensor<2x2xi7>)
    -> tensor<4x2x!HLFHE.eint<6>>
  {
    %0 = "HLFHELinalg.matmul_eint_int"(%arg0, %arg1) {"tile-sizes" = [2, 2, 2]} :
           (tensor<4x2x!HLFHE.eint<6>>, tensor<2x2xi7>) -> tensor<4x2x!HLFHE.eint<6>>
    return %0 : tensor<4x2x!HLFHE.eint<6>>
  }

becomes:

  func @main(%arg0: tensor<4x2x!HLFHE.eint<6>>, %arg1: tensor<2x2xi7>)
    -> tensor<4x2x!HLFHE.eint<6>>
  {
    %c2 = arith.constant 2 : index
    %c0 = arith.constant 0 : index
    %c4 = arith.constant 4 : index

    %0 = "HLFHELinalg.zero"() : () -> tensor<4x2x!HLFHE.eint<6>>
    %1 = scf.for %arg2 = %c0 to %c4 step %c2 iter_args(%arg3 = %0)
           -> (tensor<4x2x!HLFHE.eint<6>>) {
      %2 = scf.for %arg4 = %c0 to %c2 step %c2 iter_args(%arg5 = %arg3)
             -> (tensor<4x2x!HLFHE.eint<6>>) {
        %3 = scf.for %arg6 = %c0 to %c2 step %c2 iter_args(%arg7 = %arg5)
	       -> (tensor<4x2x!HLFHE.eint<6>>) {
          %4 = tensor.extract_slice %arg0[%arg2, %arg4] [2, 2] [1, 1] :
	         tensor<4x2x!HLFHE.eint<6>> to tensor<2x2x!HLFHE.eint<6>>
          %5 = tensor.extract_slice %arg1[%arg4, %arg6] [2, 2] [1, 1] :
	         tensor<2x2xi7> to tensor<2x2xi7>
          %6 = tensor.extract_slice %arg7[%arg2, %arg6] [2, 2] [1, 1] :
	         tensor<4x2x!HLFHE.eint<6>> to tensor<2x2x!HLFHE.eint<6>>

          %7 = "HLFHELinalg.matmul_eint_int"(%4, %5) :
	         (tensor<2x2x!HLFHE.eint<6>>, tensor<2x2xi7>)
		 -> tensor<2x2x!HLFHE.eint<6>>

          %8 = "HLFHELinalg.add_eint"(%6, %7) :
	         (tensor<2x2x!HLFHE.eint<6>>, tensor<2x2x!HLFHE.eint<6>>)
		 -> tensor<2x2x!HLFHE.eint<6>>

          %9 = tensor.insert_slice %8 into %arg7[%arg2, %arg6] [2, 2] [1, 1] :
	         tensor<2x2x!HLFHE.eint<6>> into tensor<4x2x!HLFHE.eint<6>>

          scf.yield %9 : tensor<4x2x!HLFHE.eint<6>>
        }
        scf.yield %3 : tensor<4x2x!HLFHE.eint<6>>
      }
      scf.yield %2 : tensor<4x2x!HLFHE.eint<6>>
    }
    return %1 : tensor<4x2x!HLFHE.eint<6>>
  }

Only full tiles are supported, i.e., the size of the dimensions of the
operands must be a multiple of the respective tile sizes.
2021-12-17 16:09:59 +01:00
Andi Drebes
77b7aa2f7c fix(compiler): Fix warnings and naming in test for parametric slices
- Rename `extract_slice_parametric_2x2` to
  `extract_slice_parametric_2x2x2x2` to reflect the 4-dimensional
  structure of the tiles.

- Make the array with the specification of the dimensions in
  `extract_slice_parametric_2x2x2x2` a `constexpr` in order to prevent
  the array `A` from being treated as a variable-length array.

- Cast the expression for the expected size of the result to `size_t`
  and change the type of the induction variables of the loop nest
  producing the initial values for the array `A` to `int64_t` to avoid
  warnings about the comparison of integer expressions with different
  signedness.
2021-12-17 15:52:57 +01:00
Andi Drebes
27ca5122bc enhance(compiler): Use named constant for the default pattern rewriting benefit
This introduces a new header file `zamalang/Support/Constants.h` for
constants, currently only populated with a constant for the default
pattern rewriting benefit of 1.
2021-12-17 15:28:21 +01:00
youben11
2e5bff93fd ci: check if there are commits to squash
we can then configure github to never merge when this doesn't pass
2021-12-17 08:46:38 +01:00
youben11
acf91c78a7 fix(ci): disable release worflow run on master with no tag
There were both runs of release for master and the tag push, so we now
match the tag push
2021-12-16 11:43:28 +01:00
youben11
319cc3fd28 fix(python): copy dynamic library into macos wheel 2021-12-16 09:15:25 +01:00
youben11
b812f6f7f2 feat(python): version python package from git tag
automatic detection of version from git tag and update of the python
version file
2021-12-16 09:15:25 +01:00
youben11
a94e05e85b ci: release mac
improve current workflow: more parallelism and factoring of steps with
matrix
2021-12-16 09:15:25 +01:00
youben11
aa07d12910 fix(python): add PyYAML as deps 2021-12-15 16:24:35 +01:00
youben11
d4f0dbc4f8 fix: add /build/bin to PATH
FileCheck wasn't found during tests
2021-12-14 15:04:08 +01:00
youben11
60b2cfd9b7 feat: support more dtype for scalars/tensors
dtype supported now: uint8, uint16, uint32, uint64
2021-12-13 17:40:28 +01:00
youben11
550318f67e feat: support different numpy object types as input
- Scalar types: int, np.uint8 (to extend with other types later), and np.ndarray with shape == ()
- Tensor types: np.ndarray
2021-12-13 17:40:28 +01:00
rudy
d34792c977 fix(compiler): remove 1 warning (usgined vs signed) 2021-12-13 16:43:35 +01:00
youben11
6c1800048a ci: test on gcc6.3 2021-12-13 16:35:56 +01:00
youben11
da8e6c3c0d refactor(python): customize python package build 2021-12-13 16:35:56 +01:00
Andi Drebes
16d0502f56 fix(compiler): Initialize strides of memref parameters when JIT-invoking a function
Upon invocation of a function with memref arguments, the strides for
all dimensions are currently set to 0. This causes dynamic offsets to
be calculated incorrectly in the function body.

This patch replaces the placeholder values with the actual strides for
each dimension and adds a test with parametric slice extraction from a
tensor that triggers dynamic indexing.
2021-12-13 15:20:54 +01:00
Antoniu Pop
bb44124999 feat(dfr): add the DFR (DataFlow Runtime). 2021-12-08 18:35:29 +00:00
youben11
5773310215 feat(ci): release on tag pushed (linux only)
The release workflow should, whenever a tag is pushed,
create a draft release on github (that should be manually
checked by one of us to make the actual release).
The release should contain wheels for python 3.8, 3.9, and 3.10,
as well as a tarball containing the zamacompiler and required
libraries (and installation guide is provided).
The draft release will also have an auto generated release note
that can be modified later.
2021-12-08 17:59:53 +01:00
youben11
0a7ac76b10 fix: move unique_ptr<T> to be converted to llvm::Expected
gcc 6.3 was complaining about not being able to wrap it in an
llvm::Expected
2021-12-08 17:59:53 +01:00
rudy
74d52cb649 fix(clang): remove an error reported by clang 2021-12-08 11:31:23 +01:00
youben11
4618abcc50 ci: add release workflow
currently only replace one asset from a specific release
2021-12-07 16:14:44 +01:00
youben11
58f385b11b fix: move CompilationResult in return
old toolchain (gcc 6.x) was complaining about not being able to convert
CompilationResult to Expected<CompilationResult>
2021-12-07 16:14:44 +01:00
rudy
cc58608589 chore(Lambda): simplify, extract, enhance message for bit width rounding
bit with rounding: 5bit element is widen to a standard 8bit word
2021-12-07 15:29:05 +01:00
rudy
209463be22 chore(Lambda): simplify and extract null parameter detection 2021-12-07 15:29:05 +01:00
rudy
2c56a26c75 fix(Lambda): missing superfluous check in setArg
[----------] Global test environment tear-down
[==========] 7 tests from 1 test suite ran. (1513 ms total)
[  PASSED  ] 7 tests.

  YOU HAVE 2 DISABLED TESTS
2021-12-07 15:29:05 +01:00
rudy
47b4b667bb fix(Lambda): #253 fix the bug about Lambda parameter number verification
[----------] Global test environment tear-down
[==========] 6 tests from 1 test suite ran. (1513 ms total)
[  PASSED  ] 6 tests.

  YOU HAVE 3 DISABLED TESTS

Compared to previous commit, a fatal test is disabled
2021-12-07 15:29:05 +01:00
rudy
9a09afaa80 bug(Lambda): #253 reactivate the bug about Lambda parameter number verification
[----------] Global test environment tear-down
[==========] 6 tests from 1 test suite ran. (1327 ms total)
[  PASSED  ] 5 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Lambda_check_param.scalar_tensor_to_tensor_good_number_param

 1 FAILED TEST
  YOU HAVE 3 DISABLED TESTS
2021-12-07 15:29:05 +01:00
rudy
cc9186d60d feat(tests): test lambda call with bad number of parameters or bad parameters
[----------] Global test environment tear-down
[==========] 6 tests from 1 test suite ran. (1402 ms total)
[  PASSED  ] 6 tests.

  YOU HAVE 3 DISABLED TESTS

2 tests are disabled because execution is fatal
2021-12-07 15:29:05 +01:00
Mayeul@Zama
dad4390518 feat(compiler): add a key cache 2021-12-07 12:11:56 +01:00