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
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ request, be sure to link to that issue.

## Types of changes

What types of changes does your code introduce to the HE Toolkit project?
What types of changes does your code introduce to the Encrypted Computing SDK project?
_Put an `x` in the boxes that apply_

- [ ] Bugfix (non-breaking change which fixes an issue)
Expand All @@ -21,7 +21,7 @@ the PR. If you are unsure about any of them, do not hesitate to ask. We are
here to help! This is simply a reminder of what we are going to look for before
merging your code._

- [ ] I have read the [CONTRIBUTING](https://github.com/IntelLabs/hec-p-isa-tools/blob/main/CONTRIBUTING.md) agreement
- [ ] I have read the [CONTRIBUTING](https://github.com/IntelLabs/encrypted-computing-sdk/blob/main/CONTRIBUTING.md) agreement
- [ ] Current formatting and unit tests / base functionality passes locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works (if appropriate)
- [ ] I have added necessary documentation (if appropriate)
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,16 @@ repos:
- -rn # Only display messages
- -sn # Don't display the score
- --source-roots=kerngen # Working directory
- id: clang-format-14
name: clang-format-14
entry: clang-format-14
language: system
files: \.(c|cc|cxx|cpp|h|hpp|hxx|inl)$
args: ["-i", "--style=file"]
- id: cpplint
name: cpplint
entry: cpplint
language: system
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
args:
- --recursive
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### License

The Intel Encrypted Computing SDK project is licensed under the terms in [LICENSE](https://github.com/IntelLabs/hec-p-isa-tools/blob/main/LICENSE). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
The Intel Encrypted Computing SDK project is licensed under the terms in [LICENSE](https://github.com/IntelLabs/encrypted-computing-sdk/blob/main/LICENSE). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.

### Sign your work

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Intel P-ISA Tools project welcomes external contributions through pull
requests to the `main` branch.

Please refer to the [Contributing](CONTRIBUTING.md) and
[Code of Conduct](CODE_OF_CONDUCT) documents for additional information on
[Code of Conduct](CODE_OF_CONDUCT.md) documents for additional information on
the contribution acceptance guidelines.

We use signed commits, please remember to sign your commits before making a
Expand All @@ -93,6 +93,6 @@ the tests pass.

# Feedback
We encourage feedback and suggestions via
[GitHub Issues](https://github.com/IntelLabs/hec-p-isa-tools/issues) as well
[GitHub Issues](https://github.com/IntelLabs/encrypted-computing-sdk/issues) as well
as via
[GitHub Discussions](https://github.com/IntelLabs/hec-p-isa-tools/discussions).
[GitHub Discussions](https://github.com/IntelLabs/encrypted-computing-sdk/discussions).
Empty file.
47 changes: 0 additions & 47 deletions functional_modeler/.pre-commit-config.yaml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,136 +1,136 @@
# HERACLES P-ISA Functional Modeler
## Table of Contents
1. [Requirements](#requirements)
2. [Build Configuration](#build-configuration)
1. [Build Type](#build-type)
1. [Third-Party Components](#third--party-components)
3. [Building](#building)
4. [Running the Functional Modeler](#running-the-functional-modeler)
5. [Running the Program Mapper](#running-the-program-mapper)
1. [Scripts](#scripts)
6. [Code Formatting](#code-formatting)
## P-ISA Documentation
Here is some documentation on the [P-ISA Instruction Set] (@ref PISA_overview)
## Requirements
Current build system uses `CMake`.
Tested Configuration(s)
- Ubuntu 22.04 (also tested on WSL2)
- C++17
- GCC == 11.3
- CMake >= 3.22.1
- SNAP (used to support graph features)
- graphviz (used for graph rendering)
- JSON for Modern CPP >= 3.11
## Build Configuration
The current build system is minimally configurable but will be improved with
time. The project directory is laid out as follows
- __functional_modeler__ *src directory for the functional modeler*
- __common__ *Common code used by p-isa tools*
### Build Options
The Follow options can be specified as cmake defines to enable / disable building of project components
- ENABLE_DATA_FORMATS="ON"
- ENABLE_FUNCTIONAL_MODELER="ON"
- ENABLE_PROGRAM_MAPPER="ON"
- ENABLE_P_ISA_UTILITIES="ON"
### Build Type
If no build type is specified, the build system will build in <b>Debug</b>
mode. Use `-DCMAKE_BUILD_TYPE` configuration variable to set your preferred
build type:
- `-DCMAKE_BUILD_TYPE=Debug` : debug mode (default if no build type is specified).
- `-DCMAKE_BUILD_TYPE=Release` : release mode. Compiler optimizations for release enabled.
- `-DCMAKE_BUILD_TYPE=RelWithDebInfo` : release mode with debug symbols.
- `-DCMAKE_BUILD_TYPE=MinSizeRel` : release mode optimized for size.
#### Third-Party Components <a name="third-party-components"></a>
This backend requires the following third party components:
- [SNAP](https://github.com/snap-stanford/snap.git)
- [JSON for modern c++](https://github.com/nlohmann/json)
These external dependencies are fetched and built at configuration time by
`cmake`, see below how to build the project.
## Building
Build from the top level of P-ISA-Functional-modeler with Cmake as follows:
```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
```
Build type can also be changed to `Debug` depending on current needs (Debug
should be used if the tool is being used to actively debug failing kernels).
## Running the Functional Modeler
Once `make` completes the you will find an executable in `build/bin` called
**functional_modeler**. This program can be used to functionally test p-isa
kernels against a seal trace, render p-isa kernels into a visible graph, and
debug kernel execution.
The program accepts a number of commandline options to control its usage.
A standard test is of the form
```bash
./functional_modeler <he_op.csv> --strace <he_op_trace_v0.json>
```
For example
```bash
functional_modeler p_isa_ops/t.2.add.14.csv --strace traces/add_16384_l2_m3_v0.json
```
performs a functional check for a 16k poly mod add operation checked against a
seal trace containing inputs and outputs.
The full list of currently supported options are listed below.
```bash
Usage:
functional_modeler p_isa_op OPTIONS
POSITIONAL ARGUMENTS: 1
p_isa_op
Location of a file containing a list in CSV format for p_isa instructions
OPTIONS:
--json_data, --json, -jd Location of a json data file containing HEC formatted data
--input_memory_file, --imem, -im Location of a memory file to be read and set as input before executing any instructions
--output_memory_file, --omem, -om Location to write a memory file containing all device memory after all instructions have been executed
--program_inputs_file, --pif, -if Location to a file containing program inputs in csv format. Loaded after any memory file(s) and data file but before execution
--program_outputs_file, --pof, -of Location to write a file containing program outputs in csv format. Written after program execution
--graph_file_name, --gn, -gf Sets the name of the file for the output graph image [ default=<p_isa_op_file_prefix>.png ]
--hardware_model, -hwm Available hardware models - (HEC-relaxed-mem,HEC-strict-mem,example)
--hec_dataformats_data, --hdd, -hd Location of HEC data-formats data manifest file
--hec_dataformats_poly_program_location, --hdp, -pp Location of HEC data-formats poly program file
--verbose, -v Enables more verbose execution reporting to stdout
--render_graph, -rg Enables rendering of p_isa graph in PNG and DOT file formats
--export_inputs, -ei Exports program inputs file to the file specified by --program_inputs_file or program_inputs.csv if none specified
--advanced_performance_analysis, -apa Enables advanced performance analysis and cycle count prediction
--verbose_output_checking, -voc Enables functional validation of functional execution
--validate_intermediate_results, -vir Enables functional validation of intermediates - if --disable_function_validation, this will be automatically set to false
--enable_advanced_debug_tracing, -dt Enables advanced debug execution and tracing. Warning: May significantly increase memory usage and reduce performance
--hec_dataformats_mode, --hdfm, -hm Uses hec data-formats execution pipeline
--disable_graphs, --graphs, -g Disables graph building and features
--disable_functional_execution, --nofunctional Disable functional execution of instruction stream
--disable_functional_validation, --novalidate, -nfv Disables functional validation of functional execution
-h, /h, \h, --help, /help, \help
Shows this help.
```
## Code Formatting
The repository includes `pre-commit` and `clang-format` hooks to help ensure
code consistency. It is recommended to install `pre-commit` and `pre-commit
hooks` prior to committing to repo.
# HERACLES P-ISA Functional Modeler

## Table of Contents
1. [Requirements](#requirements)
2. [Build Configuration](#build-configuration)
1. [Build Type](#build-type)
1. [Third-Party Components](#third--party-components)
3. [Building](#building)
4. [Running the Functional Modeler](#running-the-functional-modeler)
5. [Running the Program Mapper](#running-the-program-mapper)
1. [Scripts](#scripts)
6. [Code Formatting](#code-formatting)


## P-ISA Documentation
Here is some documentation on the [P-ISA Instruction Set] (@ref PISA_overview)

## Requirements

Current build system uses `CMake`.

Tested Configuration(s)
- Ubuntu 22.04 (also tested on WSL2)
- C++17
- GCC == 11.3
- CMake >= 3.22.1
- SNAP (used to support graph features)
- graphviz (used for graph rendering)
- JSON for Modern CPP >= 3.11

## Build Configuration

The current build system is minimally configurable but will be improved with
time. The project directory is laid out as follows

- __functional_modeler__ *src directory for the functional modeler*
- __common__ *Common code used by p-isa tools*

### Build Options
The Follow options can be specified as cmake defines to enable / disable building of project components
- ENABLE_DATA_FORMATS="ON"
- ENABLE_FUNCTIONAL_MODELER="ON"
- ENABLE_PROGRAM_MAPPER="ON"
- ENABLE_P_ISA_UTILITIES="ON"

### Build Type

If no build type is specified, the build system will build in <b>Debug</b>
mode. Use `-DCMAKE_BUILD_TYPE` configuration variable to set your preferred
build type:

- `-DCMAKE_BUILD_TYPE=Debug` : debug mode (default if no build type is specified).
- `-DCMAKE_BUILD_TYPE=Release` : release mode. Compiler optimizations for release enabled.
- `-DCMAKE_BUILD_TYPE=RelWithDebInfo` : release mode with debug symbols.
- `-DCMAKE_BUILD_TYPE=MinSizeRel` : release mode optimized for size.

#### Third-Party Components <a name="third-party-components"></a>
This backend requires the following third party components:

- [SNAP](https://github.com/snap-stanford/snap.git)
- [JSON for modern c++](https://github.com/nlohmann/json)

These external dependencies are fetched and built at configuration time by
`cmake`, see below how to build the project.

## Building
Build from the top level of P-ISA-Functional-modeler with Cmake as follows:

```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
```

Build type can also be changed to `Debug` depending on current needs (Debug
should be used if the tool is being used to actively debug failing kernels).

## Running the Functional Modeler

Once `make` completes the you will find an executable in `build/bin` called
**functional_modeler**. This program can be used to functionally test p-isa
kernels against a seal trace, render p-isa kernels into a visible graph, and
debug kernel execution.
The program accepts a number of commandline options to control its usage.

A standard test is of the form
```bash
./functional_modeler <he_op.csv> --strace <he_op_trace_v0.json>
```
For example

```bash
functional_modeler p_isa_ops/t.2.add.14.csv --strace traces/add_16384_l2_m3_v0.json
```

performs a functional check for a 16k poly mod add operation checked against a
seal trace containing inputs and outputs.

The full list of currently supported options are listed below.
```bash
Usage:
functional_modeler p_isa_op OPTIONS

POSITIONAL ARGUMENTS: 1
p_isa_op
Location of a file containing a list in CSV format for p_isa instructions

OPTIONS:
--json_data, --json, -jd Location of a json data file containing HEC formatted data
--input_memory_file, --imem, -im Location of a memory file to be read and set as input before executing any instructions
--output_memory_file, --omem, -om Location to write a memory file containing all device memory after all instructions have been executed
--program_inputs_file, --pif, -if Location to a file containing program inputs in csv format. Loaded after any memory file(s) and data file but before execution
--program_outputs_file, --pof, -of Location to write a file containing program outputs in csv format. Written after program execution
--graph_file_name, --gn, -gf Sets the name of the file for the output graph image [ default=<p_isa_op_file_prefix>.png ]
--hardware_model, -hwm Available hardware models - (HEC-relaxed-mem,HEC-strict-mem,example)
--hec_dataformats_data, --hdd, -hd Location of HEC data-formats data manifest file
--hec_dataformats_poly_program_location, --hdp, -pp Location of HEC data-formats poly program file
--verbose, -v Enables more verbose execution reporting to stdout
--render_graph, -rg Enables rendering of p_isa graph in PNG and DOT file formats
--export_inputs, -ei Exports program inputs file to the file specified by --program_inputs_file or program_inputs.csv if none specified
--advanced_performance_analysis, -apa Enables advanced performance analysis and cycle count prediction
--verbose_output_checking, -voc Enables functional validation of functional execution
--validate_intermediate_results, -vir Enables functional validation of intermediates - if --disable_function_validation, this will be automatically set to false
--enable_advanced_debug_tracing, -dt Enables advanced debug execution and tracing. Warning: May significantly increase memory usage and reduce performance
--hec_dataformats_mode, --hdfm, -hm Uses hec data-formats execution pipeline
--disable_graphs, --graphs, -g Disables graph building and features
--disable_functional_execution, --nofunctional Disable functional execution of instruction stream
--disable_functional_validation, --novalidate, -nfv Disables functional validation of functional execution

-h, /h, \h, --help, /help, \help
Shows this help.
```

## Code Formatting
The repository includes `pre-commit` and `clang-format` hooks to help ensure
code consistency. It is recommended to install `pre-commit` and `pre-commit
hooks` prior to committing to repo.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.