From 1a7de9588e103fa38ec69bd5664c3bc41eea0625 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 10 Oct 2023 18:32:06 +0000 Subject: [PATCH] Add LoongArch64 Support Patch submitted by user Xinmudotmoe on github Change-Id: I58fd035b4ec4856f20d63747ababd49fa9764348 --- runtime/hsa-runtime/CMakeLists.txt | 2 +- runtime/hsa-runtime/image/util.h | 1 + runtime/hsa-runtime/inc/hsa.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/hsa-runtime/CMakeLists.txt b/runtime/hsa-runtime/CMakeLists.txt index 130815c51e..01d1fc2c0e 100644 --- a/runtime/hsa-runtime/CMakeLists.txt +++ b/runtime/hsa-runtime/CMakeLists.txt @@ -207,7 +207,7 @@ add_dependencies( ${CORE_RUNTIME_TARGET} amd_trap_handler_v2 ) add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/core/runtime/blit_shaders ) add_dependencies( ${CORE_RUNTIME_TARGET} amd_blit_shaders_v2) -if ( NOT DEFINED IMAGE_SUPPORT AND CMAKE_SYSTEM_PROCESSOR MATCHES "i?86|x86_64|amd64|AMD64" ) +if ( NOT DEFINED IMAGE_SUPPORT AND CMAKE_SYSTEM_PROCESSOR MATCHES "i?86|x86_64|amd64|AMD64|loongarch64" ) set ( IMAGE_SUPPORT ON ) endif() set ( IMAGE_SUPPORT ${IMAGE_SUPPORT} CACHE BOOL "Build with image support (default: ON for x86, OFF elsewise)." ) diff --git a/runtime/hsa-runtime/image/util.h b/runtime/hsa-runtime/image/util.h index 3a045c7158..8482e41a4b 100644 --- a/runtime/hsa-runtime/image/util.h +++ b/runtime/hsa-runtime/image/util.h @@ -77,6 +77,7 @@ namespace image { #include "mm_malloc.h" #if defined(__i386__) || defined(__x86_64__) #include +#elif defined(__loongarch64) #else #error \ "Processor not identified. " \ diff --git a/runtime/hsa-runtime/inc/hsa.h b/runtime/hsa-runtime/inc/hsa.h index bd0ee1e698..31ff2b8a9a 100644 --- a/runtime/hsa-runtime/inc/hsa.h +++ b/runtime/hsa-runtime/inc/hsa.h @@ -80,7 +80,7 @@ // Try to detect CPU endianness #if !defined(LITTLEENDIAN_CPU) && !defined(BIGENDIAN_CPU) #if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \ - defined(_M_X64) + defined(_M_X64) || defined(__loongarch64) #define LITTLEENDIAN_CPU #endif #endif