Skip to content
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

Getting started #302

Open
reedkotler opened this issue Sep 29, 2023 · 20 comments
Open

Getting started #302

reedkotler opened this issue Sep 29, 2023 · 20 comments

Comments

@reedkotler
Copy link

My first interest is to just use pretrained models and do some performance analysis.

I see the pretrained model for inlining-for-size.

Is there a pretrained model for register-allocation-for-performance ?

If so, how do I enable it.

TIA.

@boomanaiden154
Copy link
Collaborator

The register allocation for performance release is available at https://github.com/google/ml-compiler-opt/releases/tag/regalloc-evict-v1.0. If you set the model path to the URL while compiling LLVM, it should download and embed the release into the build (assuming you have the necessary prerequisites like tensorflow) installed so that you can then enable it in the compilation of your project with the appropriate -mllvm flags.

@reedkotler
Copy link
Author

Has anyone built the two demos recently from the instructions in the README.md?
Tia

@reedkotler
Copy link
Author

python 3.8.x/3.9.x/3.10.x. -- i have python3.8 installed but if i say python -V it has 3.7.3 but python3.8 -V will show 3.8.12 . Is this sufficient? will the scripts be finding the right things?
tia
reed

@reedkotler
Copy link
Author

Sorry for so many questions but i'm under some huge time pressure from management.
Is debian 10 going to work? The instructions say ubuntu 20

@mtrofin
Copy link
Collaborator

mtrofin commented Sep 30, 2023

python: you need at least 3.8. One good way to tell if things work is by running the tests. You can maybe create a venv using your python3.8 - like python3.8 -m venv /where/you/want/it (see more at that link about how to use a venv)

OS: Debian 10 should work, our bots run off 10.2.1-6.

If all you need is to try out the pre-trained models, the easiest is to do this (following basically buildbot/buildbot_init.sh)

  • make sure the packages listed there (L58 down) are installed
  • set up your python venv, activate it. Let's say it's under /work/python3.8, meaning you had to do source /work/python3.8/bin/activate to activate it.
  • from this repo, run pipenv sync --system
  • find where tensorflow is installed:
    TF_PIP=$(python -c "import tensorflow as tf; import os; print(os.path.dirname(tf.__file__))").

If you echo $TF_PIP it should say something like /work/python3.8/lib/python3.8/site-packages/tensorflow

  • in your llvm repo, assuming it's in /work/llvm-project, and you created a /work/llvm-project/build and you cd-ed in that /work/llvm-project/build dir:
cmake /work/llvm-project/llvm -DCMAKE_BUILD_TYPE=Release -DTENSORFLOW_AOT_PATH=${TF_PIP} -DLLVM_ENABLE_PROJECTS="clang" -GNinja -DLLVM_INLINER_MODEL_PATH=download -DLLVM_INLINER_MODEL_CURRENT_URL=https://github.com/google/ml-compiler-opt/releases/download/inlining-Oz-v1.1/inlining-Oz-99f0063-v1.1.tar.gz -DLLVM_RAEVICT_MODEL_PATH=download -DLLVM_RAEVICT_MODEL_CURRENT_URL=https://github.com/google/ml-compiler-opt/releases/download/regalloc-evict-v1.0/regalloc-evict-e67430c-v1.0.tar.gz -DPython3_ROOT_DIR=/work/python3.8

Of course, adjusting -DLLVM_ENABLE_PROJECTS as you need.

The mlgo-related flags are the -DTENSORFLOW_AOT_PATH and the 2 pairs about the models (download and "from where"). The last flag is because we use a venv and cmake ignores that by default (despite you running within the activated environment) and would pick the highest python in its default environment. We need the right python to run during build because we compile the saved models to .h + .o files and that compiler, which ships in the tensorflow pip package, is invoked through a python wrapper.

@reedkotler
Copy link
Author

reedkotler commented Sep 30, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 1, 2023 via email

@boomanaiden154
Copy link
Collaborator

The specific information on what is on the buildbot is available on https://lab.llvm.org. If you go to this URL, search for ml-opt click on one of the three ml-opt-* builders, then click on one of the builds (like this one), you can select the Worker: tab which will give you the information buildbot records about the worker. In this case, it's the following:

How to reproduce locally: https://github.com/google/ml-compiler-opt/wiki/BuildBotReproduceLocally Linux ml-opt-devrel-x86-64-b1 5.10.0-14-cloud-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 GNU/Linux Fri Sep 29 20:08:46 UTC 2023 cmake version 3.25.1 g++ (Debian 10.2.1-6) 10.2.1 20210110 GNU gold (GNU Binutils for Debian 2.35.2) 1.16 Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 46 bits physical, 48 bits virtual CPU(s): 24 On-line CPU(s) list: 0-23 Thread(s) per core: 2 Core(s) per socket: 12 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 63 Model name: Intel(R) Xeon(R) CPU @ 2.30GHz Stepping: 0 CPU MHz: 2299.998 BogoMIPS: 4599.99 Hypervisor vendor: KVM Virtualization type: full L1d cache: 384 KiB L1i cache: 384 KiB L2 cache: 3 MiB L3 cache: 45 MiB NUMA node0 CPU(s): 0-23 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Mitigation; PTE Inversion Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state unknown Vulnerability Meltdown: Mitigation; PTI Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat md_clear arch_capabilities

Which does show Debian 10.2.1-6.

@reedkotler
Copy link
Author

reedkotler commented Oct 1, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 1, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 1, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 1, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 1, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 2, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 2, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 2, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 2, 2023 via email

@reedkotler
Copy link
Author

reedkotler commented Oct 2, 2023 via email

@mtrofin
Copy link
Collaborator

mtrofin commented Oct 2, 2023

Is the host x86?

@reedkotler
Copy link
Author

reedkotler commented Oct 2, 2023 via email

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

No branches or pull requests

3 participants