-
Notifications
You must be signed in to change notification settings - Fork 706
pip install reference_model and use pybind #7077
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,19 +74,15 @@ def get_tosa_compile_spec_unbuilt( | |
| the compile spec before calling .build() to finalize it. | ||
| """ | ||
| if not custom_path: | ||
| intermediate_path = maybe_get_tosa_collate_path() or tempfile.mkdtemp( | ||
| prefix="arm_tosa_" | ||
| ) | ||
| else: | ||
| intermediate_path = custom_path | ||
| custom_path = maybe_get_tosa_collate_path() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Erik-Lundell - keep unrelated related changes in different commits, same PR is OK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we don't have to save files unless we want to with this change, we don't need to create a temporary dir when custom_path is not explicitly set -> I viewed this as a related change. |
||
|
|
||
| if not os.path.exists(intermediate_path): | ||
| os.makedirs(intermediate_path, exist_ok=True) | ||
| if custom_path is not None and not os.path.exists(custom_path): | ||
|
||
| os.makedirs(custom_path, exist_ok=True) | ||
| compile_spec_builder = ( | ||
| ArmCompileSpecBuilder() | ||
| .tosa_compile_spec(tosa_version) | ||
| .set_permute_memory_format(permute_memory_to_nhwc) | ||
| .dump_intermediate_artifacts_to(intermediate_path) | ||
| .dump_intermediate_artifacts_to(custom_path) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess OK to call with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be ok. If you run on FVP and have custom_path=None you will get a crash, but with a explanatory error message. |
||
| ) | ||
|
|
||
| return compile_spec_builder | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,7 +88,7 @@ ethos_u_base_rev="24.08" | |
|
|
||
| # tosa reference model | ||
| tosa_reference_model_url="https://review.mlplatform.org/tosa/reference_model" | ||
| tosa_reference_model_rev="f9ea4ab7da19318fe36b1c34d68a3e40fd6e56c5" | ||
| tosa_reference_model_rev="c5570b79e90c3a36ab8c4ddb8ee3fbc2cd3f7c38" | ||
|
|
||
| # vela | ||
| vela_repo_url="https://review.mlplatform.org/ml/ethos-u/ethos-u-vela" | ||
|
|
@@ -223,64 +223,19 @@ function patch_repo() { | |
| } | ||
|
|
||
| function setup_tosa_reference_model() { | ||
| # The debug flow on the host includes running on a reference implementation of TOSA | ||
| # This is useful primarily for debug of quantization accuracy, but also for internal | ||
| # errors for the early codebase | ||
| cd "${root_dir}" | ||
| if [[ ! -e reference_model ]]; then | ||
| git clone ${tosa_reference_model_url} | ||
| cd reference_model | ||
| git checkout ${tosa_reference_model_rev} | ||
| git submodule update --init --recursive | ||
| cd .. | ||
| fi | ||
| cd reference_model | ||
| mkdir -p build | ||
| cd build | ||
| cmake .. | ||
|
|
||
| # make use of half the cores for building | ||
| if [[ "${OS}" == "Linux" ]]; then | ||
| n=$(( $(nproc) / 2 )) | ||
| elif [[ "${OS}" == "Darwin" ]]; then | ||
| n=$(( $(sysctl -n hw.logicalcpu) / 2 )) | ||
| else | ||
| n=1 | ||
| fi | ||
|
|
||
| if [[ "$n" -lt 1 ]]; then | ||
| n=1 | ||
| fi | ||
|
|
||
| # reference_model flatbuffers version clashes with Vela. | ||
| # go with Vela's since it newer. | ||
| # Could cause issues down the line, beware.. | ||
|
||
| pip install tosa-tools@git+${tosa_reference_model_url}@${tosa_reference_model_rev} --no-dependencies flatbuffers | ||
|
|
||
| make -j"${n}" | ||
| cd reference_model | ||
| tosa_bin_path=`pwd` | ||
| echo "export PATH=\${PATH}:${tosa_bin_path}" >> "${setup_path_script}" | ||
| } | ||
|
|
||
| function setup_vela() { | ||
| # | ||
| # Prepare the Vela compiler for AoT to Ethos-U compilation | ||
| # | ||
| cd "${root_dir}" | ||
| if [[ ! -e ethos-u-vela ]]; then | ||
| git clone ${vela_repo_url} | ||
| repo_dir="${root_dir}/ethos-u-vela" | ||
| base_rev=${vela_rev} | ||
| patch_repo | ||
| fi | ||
| cd "${root_dir}/ethos-u-vela" | ||
|
|
||
| # different command for conda vs venv | ||
| VNV=$(python3 -c "import sys; print('venv') if (sys.prefix != sys.base_prefix) else print('not_venv')") | ||
| if [ ${VNV} == "venv" ]; then | ||
| pip install . | ||
| else | ||
| # if not venv, we need the site-path where the vela | ||
| vela_path=$(python -c "import site; print(site.USER_BASE+'/bin')") | ||
| echo "export PATH=\${PATH}:${vela_path}" >> ${setup_path_script} | ||
| pip install . --user | ||
| fi | ||
| pip install ethos-u-vela@git+${vela_repo_url}@${vela_rev} | ||
digantdesai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| ######## | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result of an incorrect merge, will add back. Good catch, thanks!