-
Notifications
You must be signed in to change notification settings - Fork 232
How to regenerate kernel db
The db_sync test from the test/gtest directory can be used to regenerate the *.kdb files in addition to verifying their accuracy.
Steps for generating kdb files:
-
KDB files must be generated on their target architecture. Eg gfx942.kdb must be generated on a MI300 machine.
-
Load a docker image on the machine with the desired software environment.
-
Clone MIOpen and change to the desired branch. Also use git-lfs to pull the kdb files
a.
git-lfs pull --exclude=
-
Install MIOpen dependencies if they are not already available on the image.
a.
cd MIOpen; CXX=/opt/rocm/llvm/bin/clang++ cget install -f ./dev-requirements.txt --prefix ~/MIOpen/deps
-
Build MIOpen with COMGR and HIPRTC disabled so that kernel objects are generated without target id.
a.
mkdir build; cd build; CXX=/opt/rocm/llvm/bin/clang++ cmake -DMIOPEN_TEST_DBSYNC=1 -DCMAKE_INSTALL_PREFIX=~/MIOpen/install -DCMAKE_PREFIX_PATH=\~/MIOpen/deps -DMIOPEN_USE_COMGR=Off -DMIOPEN_USE_HIPRTC=Off ..
b.
LLVM_PATH=/opt/rocm/llvm make -j$(nproc) install test_db_sync
-
Current copies of the MIOpen dbs will be in ~/MIOpen/build/share/miopen/db after building MIOpen. To do a full regeneration of the kdb, the target kdb will need to be emptied here.
a.
sqlite3 ~/MIOpen/build/share/miopen/db/gfx942.kdb "delete from kern_db"
-
Now test_db_sync can be run to generate the full kdb in the user directory.
a.
MIOPEN_USER_DB_PATH=~/.cache/miopen MIOPEN_SYSTEM_DB_PATH=\~/MIOpen/build/share/miopen/db MIOPEN_TEST_DBSYNC=1 ./bin/test_db_sync
-
The complete *.ukdb file will be at MIOPEN_USER_DB_PATH, copy this file to the target kdb name eg gfx942.kdb.
-
Disable journaling for the new kdb file
a.
sqlite3 gfx942.kdb "pragma journal_mode=delete"
-
Replace the kdb.bz2 file in MIOpen/src/kernels/
a.
lbzip2 -kf gfx942.kdb
-
The .gitattributes file marks this filetype as a lfs file. git add/commit/push can be called on the kdb.bz2 file the same as a usual git file.