Skip to content

Commit

Permalink
additional cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pilkicTT committed Jan 30, 2025
1 parent c05bbc9 commit 6cc2aab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,9 @@ jobs:
- name: Install wheel
shell: bash
run: |
# python3 -m venv venv
# source venv/bin/activate
source env/activate
pip install tvm*.whl --force-reinstall
pip install forge*.whl --force-reinstall
pip install tvm*.whl --no-deps --force-reinstall
pip install forge*.whl --no-deps --force-reinstall
- name: Run Test
env:
Expand All @@ -234,9 +232,7 @@ jobs:
FORGE_DISABLE_REPORTIFY_DUMP: 1
shell: bash
run: |
# source venv/bin/activate
source env/activate
unset TT_METAL_HOME
apt-get update
apt install -y libgl1 libglx-mesa0
set -o pipefail # Ensures that the exit code reflects the first command that fails
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/perf-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
env/
forge/test
pytest.ini
conftest.py
.test_durations
fetch-depth: 0 # Fetch all history and tags

Expand All @@ -77,11 +78,9 @@ jobs:
- name: Install wheel
shell: bash
run: |
python3 -m venv venv
source venv/bin/activate
pip install tvm*.whl
pip install forge*.whl
pip freeze
source env/activate
pip install tvm*.whl --no-deps --force-reinstall
pip install forge*.whl --no-deps --force-reinstall
- name: Run Perf Benchmark
shell: bash
Expand Down
6 changes: 0 additions & 6 deletions env/activate
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ export TTFORGE_VENV_DIR="${TTFORGE_VENV_DIR:-${TTFORGE_TOOLCHAIN_DIR}/venv}"

[ -f $TTFORGE_VENV_DIR/bin/activate ] && source $TTFORGE_VENV_DIR/bin/activate

if [ -n "$PROJECT_ROOT" ]; then
export TT_METAL_HOME="$PROJECT_ROOT/third_party/tt-mlir/third_party/tt-metal/src/tt-metal"
else
export TT_METAL_HOME="$(pwd)/third_party/tt-mlir/third_party/tt-metal/src/tt-metal"
fi

export TTMLIR_TOOLCHAIN_DIR="${TTMLIR_TOOLCHAIN_DIR:-/opt/ttmlir-toolchain}"

export TTMLIR_VENV_DIR="${TTMLIR_VENV_DIR:-${TTMLIR_TOOLCHAIN_DIR}/venv}"
Expand Down
28 changes: 26 additions & 2 deletions forge/forge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,33 @@ def set_home_paths():
sys.stdout = open(os.environ["LOGGER_FILE"], "w")
logger.remove()
logger.add(sys.stdout)

# TT_METAL_HOME should be one of the following:
in_wheel_path = forge_path / "forge/tt-metal"
in_source_path = (forge_path.parent.resolve() / "third_party/tt-mlir/third_party/tt-metal/src/tt-metal").resolve()

if "TT_METAL_HOME" not in os.environ:
# TT_METAL_HOME should be this file path + ../tt-mlir/tt-metal"
os.environ["TT_METAL_HOME"] = str(base_path) + "/forge/tt-metal"
if in_wheel_path.exists():
os.environ["TT_METAL_HOME"] = str(in_wheel_path)
elif in_source_path.exists():
os.environ["TT_METAL_HOME"] = str(in_source_path)
else:
logger.error(
f"TT_METAL_HOME environment variable is not set. Tried setting it to {in_wheel_path} and {in_source_path}, but neither exists. Something is wrong with the installation."
)
exit(1)

if pathlib.Path(os.environ["TT_METAL_HOME"]) not in [in_wheel_path, in_source_path]:
if pathlib.Path(os.environ["TT_METAL_HOME"]).exists():
logger.warning(
f"TT_METAL_HOME environment variable is set to {os.environ['TT_METAL_HOME']}, which looks like a non-standard path. If set incorrectly, it will cause issues during runtime."
)
else:
logger.error(
f"TT_METAL_HOME environment variable is set to {os.environ['TT_METAL_HOME']}, which does not exist. Please check if this is intentional. Unset it so that the default path is used or set it to the correct path."
)
exit(1)



set_home_paths()
Expand Down

0 comments on commit 6cc2aab

Please sign in to comment.