0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Radeon用プロファイラとアセンブラなど

Posted at

かつてRadeon用プログラムの作成に有用だったもの

プログラム

Radeon™ GPU Profiler

RadeonDeveloperPanelでプロファイルデータを収集し、RadeonGPUProfilerで情報を表示します。
RadeonGPUAnalyzerではOpenCL Cをコンパイルし、そのニモニックを表示します。

gfx900(Vega 10)の場合はv1.15.1、おそらくgfx800(RX 480など)の場合はv1.13が対応している中で最も新しいものだと思います。

clangなどOpenCL Cをクロスコンパイルできるファイルが入っています。
直接使おうとするとbitcodeの指定で引数が非常に長くなります。
また、私の環境ではclangで生成したデータを使おうとしてもclBuildProgramがCL_BUILD_PROGRAM_FAILURE, Error while BRIG Codegen phase: the binary is incompleteを返しました。

clangに指定した引数の詳細
# clclc.py

import sys
import os


kRDTS_Dir = 'D:\\tools\\RadeonDeveloperToolSuite'
kHeader_Path = kRDTS_Dir + '\\utils\\lc\\opencl\\include\\opencl-c.h'
kClang_Path = kRDTS_Dir + '\\utils\\lc\\opencl\\bin\\clang.exe'
kBitcode_Dir = kRDTS_Dir + '\\utils\\lc\\opencl\\lib\\bitcode'


def quot(s):
	return '\"' + s + '\"'


if __name__ == '__main__':
	args = [kClang_Path]
	args.append('-nogpulib')
	args.append('--target=amdgcn-amd-amdhsa')
	args.append('-fshort-wchar')
	args.append('-include')
	args.append(quot(kHeader_Path))

	for f in os.listdir(kBitcode_Dir):
		if f.lower().endswith('.bc'):
			args.append('-Xclang')
			args.append('-mlink-bitcode-file')
			args.append('-Xclang')
			args.append(quot(kBitcode_Dir + '\\' + f))

	for a in sys.argv[1:]:
		args.append(a)

	os.execv(kClang_Path, args)
clclc -x cl -cl-kernel-arg-info -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -O3 -mcpu=gfx900 hoge.cl -o clang_kernel.bin

CLRadeonExtender

アセンブラとディスアセンブラです。
アセンブルした生成物をclCreateProgramWithBinaryで流し込んでカーネルプログラムとして使用できます。
clGetProgramInfo(, CL_PROGRAM_BINARIES)で取ってきたデータをディスアセンブルできます。

ドキュメント

AMDGPU Compute Application Binary Interface

どこのようにカーネル呼出をするのかを設定する方法。

Heterogeneous System Architecture Foundation: Standards

前述ABIの補完その他。

AMD GPU ISA documentation

Vega ISAなどの情報は不十分なので、GCN 3 ISAも読むことをおすすめします。

AMD Documentation Hub

OpenCL™ Optimization Guideなどがあります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?