I don't know if anyone cares as much about optimizing these sorts of things as I do, but here's how I've compiled llama.cpp, with an AMD 5950X and Nvidia 3090.
Install AOCC and source it.
Compile AOCL-BLAS with AOCC: ./configure --enable-cblas --enable-threading=no --prefix=/usr/local --complex-return=intel CC=clang CXX=clang++ auto
Compile llama.cpp with AOCC: make -j GGML_NATIVE=ON GGML_CUDA=ON GGML_CUDA_F16=ON GGML_CUDA_DMMV_X=64 GGML_CUDA_DMMV_Y=2 CC=clang CXX=clang++ FC=flang GGML_CUDA_CCBIN='clang' GGML_BLIS=1
Run llama-server with the usual options, check the number of threads as usually the fastest (if you need some layers on the CPU) is lower than the number of cores, even less than the number of NUMA domains can be faster. Smaller models are more sensitive the thread count, larger models matter less. I found 4 threads is the fastest with my config, but even 2x28 core EPYC was fastest with like 8 threads.
If you're on Intel, use their oneMKL library, especially if you have AVX-512.