## ppl
Primitive Programming Language
## Build instructions
### Requirements
- Working C and C++ toolchains(compiler[clang], linker)
- cmake
- ninja
### 1. install git lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
#### setting up lfs for the first time
git lfs install
### 2. clone PPL
project ppl: https://gerrit-ai.sophgo.vip:8443/#/admin/projects/ppl
#### 2.1 If you had not pull code using the ssh method:
git config --global http.sslVerify false
git clone https://shengchao.li@gerrit-ai.sophgo.vip:8443/a/ppl
git config --global http.sslVerify true
#### 2.2 If you had pull code using the ssh method:
##### Change ssh to http
git remote set-url origin https://<your_name>@gerrit-ai.sophgo.vip:8443/a/ppl
#### 2.3 set up for http
##### 2.3.1 set http repo
cd ppl
##### 2.3.2 Disable Locked Authentication
git config lfs.https://gerrit-ai.sophgo.vip/ppl.git/info/lfs.locksverify false
##### 2.3.3 Local disk to save credentials (have security risk, but no need to enter a password every time you interact with the remote library)
##### note : If you have changed your password, just execute the following statement
git config --global credential.helper store
##### 2.3.4 Skip ssl certificate verification
git config http.sslVerify false
##### 2.3.5 When you change the password, you need to execute the statement below to update the locally saved password
git config --global credential.helper store
### 3. Get the LFS objects contained in the current commit
git lfs fetch
git lfs checkout
or:
git lfs pull
### 4. If need update runtime
source envsetup.sh
git config --global http.sslVerify false (suggested update outside docker)
git submodule update --init
git config --global http.sslVerify true
./update.sh
### 5. How to use git lfs
refer to: https://wiki.sophgo.com/pages/viewpage.action?pageId=127019078
### 6. Install LLVM, MLIR, Clang, and PPL
#### Using LLVM release files
download llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release.tar.gz to third_party
``` sh
tar -xvhf llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release.tar.gz
ln -sf llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release llvm_release
```
```sh
mkdir build
cd build
cd build
cmake -G Ninja .. \
-DMLIR_DIR=$PWD/../third_party/llvm_release/lib/cmake/mlir \
-DCLANG_DIR=$PWD/../third_party/llvm_release/lib/cmake/clang \
-DCMAKE_INSTALL_PREFIX=$PWD/../install \
-DCMAKE_BUILD_TYPE=Release
ninja
```
7. Download third party
The third party files stored on the server 172.22.12.22:/data/ppl_third_party/
You download by:
```sh
scp guest@172.22.12.22:/data/ppl_third_party/llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release.tar.gz .
(password:123456)
```
## Push Code
```
cd existing_repo
git pull -r
git push origin HEAD:refs/for/main
```
## Run
ppl-compile
options:
--function : function need to be converted
--I : include search path
--print-debug-info : print loc information
--print-ir : print ir
--gen-ref : generate reference groups
--chip : chip type
--x : treat input as language
--O0 : Optimisation level 0: none optimisation
--O1 : Optimisation level 1: do ppl canonicalize
--O2 : Optimisation level 2: do ppl pipeline and ppl canonicalize
--O3 : Optimisation level 3: do all ppl optimisation
--o : Output path for ir and c files
--pm-enable-printing : Enable printing of IR before and after all passed
## Test
You can use the script named ppl_compile.py to test the xx.pl file
For example:
you can test xx.pl by executing the following command.
ppl_compile.py --src ./examples/matmul/mm2.pl --chip bm1684x --gen_ref
## Profiling
### preprare PerfAI tool
download PerfAI tool from FTP:172.28.141.89 /perfAI_release/perfAI_release
mv PerfAI_Release_xxx.tar.gz to ppl/third_party
tar -xvhf PerfAI_Release_xxx.tar.gz
ln -sf PerfAI_Release_xxx.tar.gz PerfAI
cd PerfAI
pip install -r requirements.txt
### run
cd ppl/third_party/PerfAI/
source envsetup.sh
ppl_compile.py --src examples/sdma/add_c_dual_loop.pl --chip bm1690 --profiling
profiling files will generate in test_add_c_dual_loop/profiling
## CI
git clone ssh://liang.chen@gerrit-ai.sophgo.vip:29418/jenkins_pipeline.git
jenkins script
regression/ppl_ci_test.groovy
dockerfile
envsetup/docker/ppl_dailybuild.dockerfile
Raw data
{
"_id": null,
"home_page": "https://github.com/sophgo/PPL/",
"name": "tpu-ppl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "Compiler, Deep Learning",
"author": "liang.chen",
"author_email": "liang.chen@sophgo.com",
"download_url": null,
"platform": null,
"description": "## ppl\nPrimitive Programming Language\n\n## Build instructions\n\n### Requirements\n- Working C and C++ toolchains(compiler[clang], linker)\n- cmake\n- ninja\n\n### 1. install git lfs\n\ncurl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash\n\nsudo apt-get install git-lfs\n\n#### setting up lfs for the first time\ngit lfs install\n\n### 2. clone PPL\nproject ppl: https://gerrit-ai.sophgo.vip:8443/#/admin/projects/ppl\n\n#### 2.1 If you had not pull code using the ssh method:\ngit config --global http.sslVerify false\ngit clone https://shengchao.li@gerrit-ai.sophgo.vip:8443/a/ppl\ngit config --global http.sslVerify true\n\n#### 2.2 If you had pull code using the ssh method:\n##### Change ssh to http\ngit remote set-url origin https://<your_name>@gerrit-ai.sophgo.vip:8443/a/ppl\n\n#### 2.3 set up for http\n##### 2.3.1 set http repo\ncd ppl\n\n##### 2.3.2 Disable Locked Authentication\ngit config lfs.https://gerrit-ai.sophgo.vip/ppl.git/info/lfs.locksverify false\n\n##### 2.3.3 Local disk to save credentials (have security risk, but no need to enter a password every time you interact with the remote library)\n##### note : If you have changed your password, just execute the following statement\ngit config --global credential.helper store\n\n##### 2.3.4 Skip ssl certificate verification\ngit config http.sslVerify false\n\n##### 2.3.5 When you change the password, you need to execute the statement below to update the locally saved password\ngit config --global credential.helper store\n\n### 3. Get the LFS objects contained in the current commit\ngit lfs fetch\ngit lfs checkout\nor:\ngit lfs pull\n\n### 4. If need update runtime\nsource envsetup.sh\ngit config --global http.sslVerify false (suggested update outside docker)\ngit submodule update --init\ngit config --global http.sslVerify true\n./update.sh\n\n### 5. How to use git lfs\nrefer to: https://wiki.sophgo.com/pages/viewpage.action?pageId=127019078\n\n### 6. Install LLVM, MLIR, Clang, and PPL\n\n#### Using LLVM release files\n\ndownload llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release.tar.gz to third_party\n``` sh\ntar -xvhf llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release.tar.gz\nln -sf llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release llvm_release\n```\n\n```sh\nmkdir build\ncd build\n\ncd build\ncmake -G Ninja .. \\\n -DMLIR_DIR=$PWD/../third_party/llvm_release/lib/cmake/mlir \\\n -DCLANG_DIR=$PWD/../third_party/llvm_release/lib/cmake/clang \\\n -DCMAKE_INSTALL_PREFIX=$PWD/../install \\\n -DCMAKE_BUILD_TYPE=Release\nninja\n```\n\n7. Download third party\nThe third party files stored on the server 172.22.12.22:/data/ppl_third_party/\nYou download by:\n```sh\nscp guest@172.22.12.22:/data/ppl_third_party/llvm+mlir-17.0.0-x86_64-linux-gnu-ubuntu-18.04-release.tar.gz .\n(password:123456)\n```\n\n## Push Code\n```\ncd existing_repo\ngit pull -r\ngit push origin HEAD:refs/for/main\n```\n\n## Run\n\nppl-compile\noptions:\n--function : function need to be converted\n--I : include search path\n--print-debug-info : print loc information\n--print-ir : print ir\n--gen-ref : generate reference groups\n--chip : chip type\n--x : treat input as language\n--O0 : Optimisation level 0: none optimisation\n--O1 : Optimisation level 1: do ppl canonicalize\n--O2 : Optimisation level 2: do ppl pipeline and ppl canonicalize\n--O3 : Optimisation level 3: do all ppl optimisation\n--o : Output path for ir and c files\n--pm-enable-printing : Enable printing of IR before and after all passed\n\n## Test\nYou can use the script named ppl_compile.py to test the xx.pl file\n\nFor example:\nyou can test xx.pl by executing the following command.\n\nppl_compile.py --src ./examples/matmul/mm2.pl --chip bm1684x --gen_ref\n\n## Profiling\n\n### preprare PerfAI tool\n\ndownload PerfAI tool from FTP:172.28.141.89 /perfAI_release/perfAI_release\nmv PerfAI_Release_xxx.tar.gz to ppl/third_party\ntar -xvhf PerfAI_Release_xxx.tar.gz\nln -sf PerfAI_Release_xxx.tar.gz PerfAI\ncd PerfAI\npip install -r requirements.txt\n\n### run\n\ncd ppl/third_party/PerfAI/\nsource envsetup.sh\nppl_compile.py --src examples/sdma/add_c_dual_loop.pl --chip bm1690 --profiling\n\nprofiling files will generate in test_add_c_dual_loop/profiling\n\n\n## CI\ngit clone ssh://liang.chen@gerrit-ai.sophgo.vip:29418/jenkins_pipeline.git\n\njenkins script\nregression/ppl_ci_test.groovy\n\ndockerfile\nenvsetup/docker/ppl_dailybuild.dockerfile\n",
"bugtrack_url": null,
"license": "2-Clause BSD",
"summary": "A language and compiler for custom Deep Learning operations",
"version": "1.4.192",
"project_urls": {
"Homepage": "https://github.com/sophgo/PPL/"
},
"split_keywords": [
"compiler",
" deep learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b0eeb7997ccebb849fae25d2a0491d3087f22e055fc09eadd9be90e6f43c6d6d",
"md5": "c3c994757c72b24ab56a23e057211d4e",
"sha256": "062726e10fedc147f5e2fd1c43a6bb4d6d49e8aafe4756607da73eff96651205"
},
"downloads": -1,
"filename": "tpu_ppl-1.4.192-cp310-cp310-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "c3c994757c72b24ab56a23e057211d4e",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 95878623,
"upload_time": "2025-02-18T11:16:18",
"upload_time_iso_8601": "2025-02-18T11:16:18.443149Z",
"url": "https://files.pythonhosted.org/packages/b0/ee/b7997ccebb849fae25d2a0491d3087f22e055fc09eadd9be90e6f43c6d6d/tpu_ppl-1.4.192-cp310-cp310-manylinux1_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-18 11:16:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sophgo",
"github_project": "PPL",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tpu-ppl"
}