Skip to content

Instantly share code, notes, and snippets.

View cgmb's full-sized avatar

Cory Bloor cgmb

  • Advanced Micro Devices, Inc.
  • Canada
View GitHub Profile
@cgmb
cgmb / CMakeLists.txt
Last active February 22, 2023 18:59
profile rocblas_initialize() on Ubuntu 20.04
cmake_minimum_required(VERSION 3.16)
project(rocblas-init-benchmark)
find_package(rocblas REQUIRED)
add_executable(rbi main.c)
target_link_libraries(rbi PRIVATE roc::rocblas)
@cgmb
cgmb / build-rocm-5.4.2.sh
Created January 31, 2023 18:40
Build ROCm for Ubuntu 20.04
#!/usr/bin/env bash
# Build rocBLAS for ROCm 5.4.2 on Ubuntu 20.04
set -exuo pipefail
apt-get -qq update
apt-get -qq upgrade
apt-get -qq install build-essential cmake wget
WORKSPACE=$HOME # where to download and build the sources
@cgmb
cgmb / build.sh
Created January 17, 2023 23:17
Clang offload bundle example
#!/bin/sh
/opt/rocm/llvm/bin/clang++ --offload-arch=gfx906:xnack- -L/opt/rocm/hip/lib -lamdhip64 ex.hip
@cgmb
cgmb / hip-build-platform.md
Last active November 21, 2022 15:01
HIP platform selection
  1. In the install script, determine the build platform by querying [hipconfig --platform][4]
    • This is necessary, as the install script needs to know the build platform so it can to choose what dependencies to install.
    • hipconfig --platform determines the platform by reading the contents of the .hipInfo file installed as part of the hip runtime.
    • If the platform is autodetected incorrectly, [it can be be set explicitly via an environment variable][1], e.g., export HIP_PLATFORM=amd or export HIP_PLATFORM=nvidia.
  2. In CMake, find_package(hip REQUIRED) will be used for both the AMD and NVIDIA platforms.
    • There will be no need for a different find_package call on each platform; the same call will be used for both platforms.
@cgmb
cgmb / debian-workflow.sh
Created September 18, 2022 20:39
Working with Debian
#!/bin/sh
apt-get update -y
apt-get upgrade -y
apt-get install -y build-essential devscripts packaging-dev git vim
useradd -G sudo,video --shell /bin/bash --create-home cgmb
echo 'cgmb ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
gbp clone https://salsa.debian.org/rocm-team/rocm-hipamd.git
cd rocm-hipamd
@cgmb
cgmb / build-debian-rocrand.sh
Last active September 4, 2022 06:50
Build rocRAND using Debian dependencies
#!/usr/bin/env bash
apt install git build-essential cmake libgtest-dev \
rocm-cmake rocminfo libamd-comgr-dev libhsakmt-dev \
libhsa-runtime-dev file hipcc
git clone https://github.com/ROCmSoftwarePlatform/rocRAND.git
cd rocRAND
git checkout rocm-5.2.0
# These environment variables are needed for now.
@cgmb
cgmb / build-rocm-5.2.sh
Last active July 13, 2022 22:50
Build ROCm 5.2.0 on Ubuntu 20.04
#!/usr/bin/env bash
# Build ROCm 5.2.0 on Ubuntu 20.04
set -exuo pipefail
apt-get -qq update
apt-get -qq upgrade
apt-get -qq install build-essential cmake wget
WORKSPACE=$HOME # where to download and build the sources
@cgmb
cgmb / build.sh
Created July 12, 2022 08:06
How to build rocm-hipamd
# install basic tools
sudo apt install build-essential devscripts packaging-dev git vim dos2unix
# setup workspace to build in
mkdir hip
cd hip
gbp clone https://salsa.debian.org/rocm-team/rocm-hipamd.git
cd rocm-hipamd
gbp export-orig
@cgmb
cgmb / dpp-builtin-feature-test.cpp
Created July 6, 2022 01:16
Comparison of approaches to forward source compatability for new architectures
#include <hip/hip_runtime.h>
/*
* Feature Test: Test if DPP is supported. Use DPP if supported;
* use fallback if not.
*
* Pros: Successful compilation by default.
* Maybe optimal performance by default?
* Cons: The compiler would have to provide some way to test if the
* necessary DPP functionality is supported. That might not exist yet.
@cgmb
cgmb / build-log.txt
Created July 5, 2022 23:55
Misuse of __builtin_amdgcn_mov_dpp
$ hipcc -c dpp-builtin.cpp --offload-arch=gfx906
$ hipcc -c dpp-builtin.cpp --offload-arch=gfx1030
error: Illegal instruction detected: Invalid dpp_ctrl value: broadcasts are not supported on GFX10+
renamable $vgpr0 = V_MOV_B32_dpp undef $vgpr0(tied-def 0), killed $vgpr0, 323, 12, 15, 0, implicit $exec
1 error generated when compiling for gfx1030.