package/llvm: enable AMDGPU
authorValentin Korenblit <valentin.korenblit@smile.fr>
Wed, 4 Apr 2018 16:31:19 +0000 (18:31 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 4 Apr 2018 20:52:04 +0000 (22:52 +0200)
The AMDGPU backend provides ISA code generation for AMD GPU's,
starting with the R600 family up until the current GCN families.

It should not be confused with the AMDGPU Linux kernel DRM driver.

For more info: https://llvm.org/docs/AMDGPUUsage.html

Signed-off-by: Valentin Korenblit <valentin.korenblit@smile.fr>
Tested-by: Jérôme Oufella <jerome.oufella@savoirfairelinux.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/llvm/Config.in
package/llvm/llvm.mk

index 408fde2e39311bd029f6d7f664af78faa43ed6d4..70f73f4858568d92f72cdc5e6bf276ba78ea7c01 100644 (file)
@@ -24,6 +24,16 @@ config BR2_PACKAGE_LLVM
 
          http://llvm.org
 
+if BR2_PACKAGE_LLVM
+
+config BR2_PACKAGE_LLVM_AMDGPU
+       bool "AMDGPU backend"
+       help
+         Build AMDGPU target. Select this option if you are going
+         to install mesa3d with llvm and use Gallium Radeon driver.
+
+endif
+
 comment "llvm needs a toolchain w/ threads, C++, gcc >= 4.8, host gcc >= 4.8"
        depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
        depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
index 525e0f98f82d49c9bf4c45b5fe5758763522396f..9c8bf5c820be0a3b9e966637a4d4e14058b4ca84 100644 (file)
@@ -45,6 +45,15 @@ LLVM_CONF_OPTS = -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_B
 HOST_LLVM_CONF_OPTS += -DLLVM_TARGET_ARCH=$(LLVM_TARGET_ARCH)
 LLVM_CONF_OPTS += -DLLVM_TARGET_ARCH=$(LLVM_TARGET_ARCH)
 
+# Build AMDGPU backend
+# We need to build AMDGPU backend for both host and target because
+# llvm-config --targets built (host variant installed in STAGING) will
+# output only $(LLVM_TARGET_ARCH) if not, and mesa3d won't build as
+# it thinks AMDGPU backend is not installed on the target.
+ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y)
+LLVM_TARGETS_TO_BUILD += AMDGPU
+endif
+
 # Use native llvm-tblgen from host-llvm (needed for cross-compilation)
 LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen