Skip to content

[build] Add script for Deeploy environment variables and Makefile info#5

Closed
viv-eth wants to merge 3 commits into
pulp-platform:mainfrom
viv-eth:vivianep/build
Closed

[build] Add script for Deeploy environment variables and Makefile info#5
viv-eth wants to merge 3 commits into
pulp-platform:mainfrom
viv-eth:vivianep/build

Conversation

@viv-eth

@viv-eth viv-eth commented Oct 3, 2024

Copy link
Copy Markdown
Contributor

This PR introduces a new script (deeploy.sh) that sets up essential environment variables for the Deeploy project. The Makefile has been updated to reference this script, providing users an easy way to source environment variables directly from deeploy.sh after setting up the PULP SDK.

Changes:

  1. Added deeploy.sh script for defining paths to critical tools (LLVM, PULP SDK, QEMU, etc.)
  2. Updated Makefile to include instructions on sourcing the deeploy.sh script for proper environment configuration

This update simplifies the setup process by centralizing environment variables, reducing the need for manual configuration.

viv-eth and others added 3 commits October 3, 2024 15:49
Signed-off-by: Viviane <86701002+viv-eth@users.noreply.github.com>
Signed-off-by: Viviane <86701002+viv-eth@users.noreply.github.com>
@viv-eth
viv-eth marked this pull request as ready for review October 3, 2024 14:00

@Scheremo Scheremo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Viviane, thanks for your contribution.
I personally don't like sourcing bash scripts to set up the environment. Offering as an alternative is probably okay, though. In any case, please use the tool-specific path variables rather than DEEPLOY_INSTALL_DIR

Comment thread deeploy.sh
Comment on lines +1 to +4
export PULP_SDK_HOME=${DEEPLOY_INSTALL_DIR}/pulp-sdk
export LLVM_INSTALL_DIR=${DEEPLOY_INSTALL_DIR}/llvm
export PULP_RISCV_GCC_TOOLCHAIN=
export MEMPOOL_HOME=${DEEPLOY_INSTALL_DIR}/mempool

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't just set all these paths relative to DEEPLOY_INSTALL_DIR. The Makefile is set up such that previous installations may be reused, and each tool gets its own DIR variable.

Comment thread Makefile
@echo "export PULP_SDK_HOME=${PULP_SDK_INSTALL_DIR}"
@echo "export LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR}"
@echo "export PULP_RISCV_GCC_TOOLCHAIN=/PULP_SDK_IS_A_MESS"
@echo "export PULP_RISCV_GCC_TOOLCHAIN="

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not completely remove this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pulp-sdk needs the environment variable set afaik but @Scheremo could confirm.
I would prefer if the contents of the variable stay untouched 😏

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but it gets set when you source the platform specific setup script in the PULP SDK. I am certain that PULP_SDK_IS_A_MESS won't fix any problems 😉

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a diff of my environment with/without the PULP_RISCV_GCC_TOOLCHAIN environment variable:

46d45
< PULP_RISCV_GCC_TOOLCHAIN=/PULP_SDK_IS_A_MESS
59c58
< GAP_RISCV_GCC_TOOLCHAIN=/PULP_SDK_IS_A_MESS
---
> GAP_RISCV_GCC_TOOLCHAIN=
83c82
< PATH=/home/lmacan/Deeploy/install/pulp-sdk/tools/gapy:/home/lmacan/Deeploy/install/pulp-sdk/install/workstation/bin:/PULP_SDK_IS_A_MESS/bin:/home/lmacan/Deeploy/install/pulp-sdk/tools/bin:/home/lmacan/.local/bin:/home/lmacan/micromamba/condabin:/home/lmacan/.local/bin:/home/lmacan/.cargo/bin:/home/lmacan/.local/bin:/home/lmacan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
---
> PATH=/home/lmacan/Deeploy/install/pulp-sdk/tools/gapy:/home/lmacan/Deeploy/install/pulp-sdk/install/workstation/bin:/bin:/home/lmacan/Deeploy/install/pulp-sdk/tools/bin:/home/lmacan/.local/bin:/home/lmacan/micromamba/condabin:/home/lmacan/.local/bin:/home/lmacan/.cargo/bin:/home/lmacan/.local/bin:/home/lmacan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

The issue is that the pulp-sdk adds stuff into your PATH variable (that seems like fun 😃), specifically this part (the diff doesn't show it quite nicely so I cut just the scary piece):

+ /PULP_SDK_IS_A_MESS/bin
- /bin

Pulp-sdk basically adds /bin into your path in front of your other search paths which might mess up your environment. I think this was the reason to put the "/PULP_SDK_IS_A_MESS" because it's a non-existant path and doesn't screw up your environment. Bonus points for a funny name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some deep PULP lore material here 😁

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WTF, I guess I was wrong 😂 Fight fire with fire...
I thought this was just a rant, but it is actually a fix 😂

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Xeratec you underestimated pulp and Moritz, tsk tsk tsk

@Victor-Jung

Copy link
Copy Markdown
Member

Ciao Viviane, I'd be happy to merge this PR once the feedback from Moritz and Philip is applied and the bash script is moved to the scripts folder.

@Victor-Jung
Victor-Jung self-requested a review October 28, 2024 11:52
@Xeratec

Xeratec commented Nov 24, 2024

Copy link
Copy Markdown
Member

@viv-eth What is the status of that PR? Should I implement the requested changes?

@Victor-Jung

Copy link
Copy Markdown
Member

Closed for inactivity. May reopen in the future.

Storiann pushed a commit to Storiann/Deeploy that referenced this pull request Jul 17, 2026
…ulp-platform#5)

Recovers PR pulp-platform#4 (GlobalAveragePool) which was lost when GitHub merged it
into the now-deleted add-averagepool-kernel branch instead of devel,
plus the AveragePoolGrad fixture amendment that didn't make it into
PR pulp-platform#3 before merge.

GlobalAveragePool family (was in PR pulp-platform#4):
- TargetLibraries/PULPOpen/src/GlobalAveragePool.c
- Templates/FloatGlobalAveragePoolTemplate.py
- TileConstraints/GlobalAveragePoolTileConstraint.py
- Generic: GlobalAveragePool{,Grad}Layer / Parser / Checker
- PULPOpen wiring + 'GlobalAveragePool', 'GlobalAveragePoolGrad' MAPPING

AveragePoolGrad fixture (was lost from PR pulp-platform#3):
- Tests/Kernels/FP32/AveragePoolGrad/ (N=1, C=4, H=W=8, k=s=2, NCHW)

LoweringOptimizationPasses (sync with TrainingPlatform):
- Add NCHWtoNHWCAveragePoolPass + NCHWtoNHWCAveragePoolGradPass classes
- Register both in NCHWtoNHWCPass and PULPNCHWtoNHWCPass
- Extend spatialDims handling to AveragePool / AveragePoolGrad
- Variable-weight Transpose insertion in _NCHWtoNHWC_fun (training graphs)
- _remove_only_singleton_reduce_mean: skip when axis is unknown

Without these passes the AveragePoolGrad kernel would receive raw NCHW
bytes despite expecting HWC layout. With the passes registered, fixtures
stay in NCHW like forward kernels.

test_siracusa_config.py:
- KERNEL_TESTS += GlobalAveragePool
- TRAIN_KERNEL_TESTS += AveragePoolGrad, GlobalAveragePoolGrad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants