Skip to content

Commit 14a34fb

Browse files
author
David Salinas
committed
merge amd-stg-open into amd-mainline-open
Bulk Promotion for ROCm 6.1, Bulk Promotion from July 07, 2023 Merge remote-tracking branch 'gerritgit/promotion/amd-mainline-open/2023.07.20' into HEAD Change-Id: Ic865550cf3c2436a7c45c5e5940dd5c5b053ec02
2 parents 76c9e80 + 23e60f3 commit 14a34fb

28 files changed

+999
-190
lines changed

amd/comgr/CMakeLists.txt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@ cmake_minimum_required(VERSION 3.13.4)
33
project(amd_comgr VERSION "2.6.0" LANGUAGES C CXX)
44
set(amd_comgr_NAME "${PROJECT_NAME}")
55

6+
# Get git branch and commit hash to add to log for easier debugging.
7+
# Modeled after https://github.com/pmirshad/cmake-with-git-metadata.
8+
# Current working branch
9+
if(EXISTS "${CMAKE_SOURCE_DIR}/../../.git")
10+
execute_process(
11+
COMMAND git rev-parse --abbrev-ref HEAD
12+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
13+
OUTPUT_VARIABLE AMD_COMGR_GIT_BRANCH
14+
OUTPUT_STRIP_TRAILING_WHITESPACE
15+
)
16+
# Shortened commit hash
17+
execute_process(
18+
COMMAND git log -1 --format=%h
19+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
20+
OUTPUT_VARIABLE AMD_COMGR_GIT_COMMIT
21+
OUTPUT_STRIP_TRAILING_WHITESPACE
22+
)
23+
else(EXISTS "${CMAKE_SOURCE_DIR}/../../.git")
24+
set(AMD_COMGR_GIT_BRANCH "not-available")
25+
set(AMD_COMGR_GIT_COMMIT "not-available")
26+
endif(EXISTS "${CMAKE_SOURCE_DIR}/../../.git")
27+
628
include(GNUInstallDirs)
729
include(CMakePackageConfigHelpers)
830
option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" OFF)
@@ -108,7 +130,6 @@ message("--CLANG_INCLUDE_DIRS: ${CLANG_INCLUDE_DIRS}")
108130
message("----LLD_INCLUDE_DIRS: ${LLD_INCLUDE_DIRS}")
109131
message("---AMDDeviceLibs_DIR: ${AMDDeviceLibs_DIR}")
110132
message("------------ROCM_DIR: ${ROCM_DIR}")
111-
message("")
112133

113134
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
114135

@@ -136,13 +157,19 @@ set(AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS ${LLVM_DEFINITIONS})
136157
set(AMD_COMGR_PUBLIC_LINKER_OPTIONS)
137158
set(AMD_COMGR_PRIVATE_LINKER_OPTIONS)
138159

160+
list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS "-DAMD_COMGR_GIT_COMMIT=${AMD_COMGR_GIT_COMMIT}")
161+
list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS "-DAMD_COMGR_GIT_BRANCH=${AMD_COMGR_GIT_BRANCH}")
162+
message("----COMGR_GIT_COMMIT: ${AMD_COMGR_GIT_COMMIT}")
163+
message("----COMGR_GIT_BRANCH: ${AMD_COMGR_GIT_BRANCH}")
164+
message("")
165+
139166
if (UNIX)
140167
list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS
141168
-fno-rtti -Wall -Wno-attributes -fms-extensions -fvisibility=hidden)
142169
# TODO: Confirm this is actually needed due to LLVM/Clang code
143170
list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS -fno-strict-aliasing)
144171
list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS
145-
_GNU_SOURCE __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS)
172+
_GNU_SOURCE __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS AMD_COMGR_BUILD)
146173
list(APPEND AMD_COMGR_PUBLIC_LINKER_OPTIONS -pthread)
147174
if (NOT APPLE AND COMGR_BUILD_SHARED_LIBS)
148175
configure_file(

amd/comgr/cmake/opencl_pch.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function(generate_pch version)
3838

3939
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl${version}-c.pch
4040
COMMAND $<TARGET_FILE:clang> -cc1 -x cl-header -triple amdgcn-amd-amdhsa
41-
-Werror -O3 -Dcl_khr_fp64 -Dcl_khr_fp16 -DNDEBUG -cl-std=CL${version}
41+
-Werror -Wno-builtin-macro-redefined -O3 -Dcl_khr_fp64 -Dcl_khr_fp16 -DNDEBUG -cl-std=CL${version}
4242
-emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl${version}-c.pch
4343
< ${OPENCL_C_H}
4444
DEPENDS clang ${OPENCL_C_H} ${clang_resource_headers_gen}

amd/comgr/docs/ReleaseNotes.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ code bases.
1919
legal comgr-objdump option. However registering this as an LLVM option by Comgr
2020
prevents other LLVM tools or instances from registering a -h option in the same
2121
process, which is an issue because -h is a common short form for -help.
22+
- Updated default code object version used when linking code object specific
23+
device library from v4 to v5
2224

2325
New Features
2426
------------
@@ -49,6 +51,14 @@ prevented correct execution of
4951
COMPILE\_SOURCE\_WITH\_DEVICE\_LIBS\_TO\_BC action.
5052
- Fixed a multi-threading bug where programs would hang when calling Comgr APIs
5153
like amd\_comgr\_iterate\_symbols() from multiple threads
54+
- Fixed an issue where providing DataObjects with an empty name to the bitcode
55+
linking action caused errors when AMD\_COMGR\_SAVE\_TEMPS was enabled, or when
56+
linking bitcode bundles.
57+
- Updated to use lld::lldMain() introduced in D110949 instead of the older
58+
lld::elf::link in Comgr's linkWithLLD()
59+
- Added -x assembler option to assembly compilation. Before, if an assembly file
60+
did not end with a .s file extension, it was not handled properly by the Comgr
61+
ASSEMBLE\_SOURCE\_TO\_RELOCATABLE action.
5262

5363

5464
New APIs
@@ -76,6 +86,10 @@ Removed APIs
7686

7787
New Comgr Actions and Data Types
7888
--------------------------------
89+
- (Action) AMD\_COMGR\_ACTION\_COMPILE\_SOURCE\_TO\_RELOCATABLE
90+
- This action performs compile-to-bitcode, linking device libraries, and
91+
codegen-to-relocatable in a single step. By doing so, clients are able to defer more
92+
of the flag handling to toolchain. Currently only supports HIP.
7993
- (Data Type) AMD\_COMGR\_DATA\_KIND\_BC\_BUNDLE
8094
- (Data Type) AMD\_COMGR\_DATA\_KIND\_AR\_BUNDLE
8195
- These data kinds can now be passed to an AMD\_COMGR\_ACTION\_LINK\_BC\_TO\_BC
@@ -104,6 +118,12 @@ metadata querys for code object v2 objects.
104118
deprecation of code object v3 in LLVM. However, we still test loading and
105119
metadata querys for code object v3 objects.
106120
- Revamp symbolizer test to fail on errors, among other improvments
121+
- Improve linking and unbundling log to correctly store temporary files in /tmp,
122+
and to output clang-offload-bundler command to allow users to re-create Comgr
123+
unbundling.
124+
- Add git branch and commit hash for Comgr, and commit hash for LLVM to log
125+
output for Comgr actions. This can help us debug issues more quickly in cases
126+
where reporters provide Comgr logs.
107127

108128
New Targets
109129
-----------

amd/comgr/include/amd_comgr.h.in

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@
5151
// Add deprecation support for Comgr on Linux
5252
// This can be removed in favor of generic [[deprecated]] in C23, which should
5353
// also allow us to more easily include support on Windows
54+
55+
#ifndef AMD_COMGR_DEPRECATED
56+
#ifdef AMD_COMGR_BUILD
57+
#define AMD_COMGR_DEPRECATED(msg) // empty
58+
#endif
59+
#endif
60+
5461
#ifndef AMD_COMGR_DEPRECATED
5562
#if defined __GNUC__ && (__GNUC__ > 5 || defined __clang__)
5663
#define AMD_COMGR_DEPRECATED(msg) __attribute__((deprecated(msg)))
@@ -1578,8 +1585,9 @@ typedef enum amd_comgr_action_kind_s {
15781585
* Return @p AMD_COMGR_STATUS_ERROR if the link or unbundling fails.
15791586
*
15801587
* Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT
1581-
* if isa name is not set in @p info and does not match the isa name
1582-
* of all bc data objects in @p input.
1588+
* if IsaName is not set in @p info and does not match the isa name
1589+
* of all bc data objects in @p input, or if the Name field is not set for
1590+
* any DataObject in the input set.
15831591
*/
15841592
AMD_COMGR_ACTION_LINK_BC_TO_BC = 0x4,
15851593
/**
@@ -1737,10 +1745,27 @@ typedef enum amd_comgr_action_kind_s {
17371745
* if isa name or language is not set in @p info.
17381746
*/
17391747
AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC = 0xF,
1748+
/**
1749+
* Compile a single source data object in @p input in order. For each
1750+
* successful compilation add a relocatable data object to @p result.
1751+
* Resolve any include source names using the names of include data objects
1752+
* in @p input. Resolve any include relative path names using the
1753+
* working directory path in @p info. Produce relocatable for hip name in @p
1754+
* info. Compile the source for the language in @p info. Link against
1755+
* the device-specific and language-specific bitcode device libraries
1756+
* required for compilation. Currently only supports HIP language.
1757+
*
1758+
* Return @p AMD_COMGR_STATUS_ERROR if any compilation
1759+
* fails.
1760+
*
1761+
* Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT
1762+
* if isa name or language is not set in @p info.
1763+
*/
1764+
AMD_COMGR_ACTION_COMPILE_SOURCE_TO_RELOCATABLE = 0x10,
17401765
/**
17411766
* Marker for last valid action kind.
17421767
*/
1743-
AMD_COMGR_ACTION_LAST = AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC
1768+
AMD_COMGR_ACTION_LAST = AMD_COMGR_ACTION_COMPILE_SOURCE_TO_RELOCATABLE
17441769
} amd_comgr_action_kind_t;
17451770

17461771
/**

0 commit comments

Comments
 (0)