Skip to content

Commit 0bae0af

Browse files
authored
v1.0 updates.
Populate repository for v1.0 release.
1 parent b5c3c0e commit 0bae0af

53 files changed

Lines changed: 42875 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# Visual Studio project files
35+
*.sln
36+
*.vcxproj*
37+
.vs
38+
projects
39+
x64
40+
41+
# cmake files
42+
CMakeFiles
43+
CMakeCache.txt
44+
cmake_install.cmake
45+
46+
# Directories
47+
build/linux/
48+
build/windows/

CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved.
2+
cmake_minimum_required(VERSION 3.0)
3+
4+
# List of projects.
5+
project(isa_spec_manager)
6+
7+
# Setting compiler flags.
8+
set (CMAKE_CXX_COMPILER g++)
9+
set (CMAKE_CXX_STANDARD 14)
10+
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${FLAGS})
11+
12+
# Enable using folders to group projects on Windows (Visual Studio solution).
13+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
14+
15+
# Windows solution generator is a multi config generator, so define
16+
# CMAKE_CONFIGURATION_TYPES, which enables usage of $<$<CONFIG:value1>value2> syntax for Windows settings.
17+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
18+
# Visual Studio
19+
set(CMAKE_CONFIGURATION_TYPES "Release;Debug")
20+
endif()
21+
22+
# Setting project directories.
23+
# XML ISA Spec Decoder API: accepts ISA Spec for specific architecture
24+
# and provides interface for decoding of instructions or data retrieval
25+
# for specific instructions in the architecture.
26+
add_subdirectory(./source/isa_decoder)
27+
28+
# Examples: demonstrates utilities and API features using example apps
29+
add_subdirectory(./source/examples)
30+
31+
# CLI commands: provides command line interface implementation
32+
# for generation of various CLI programs.
33+
add_subdirectory(./source/isa_spec_cli)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 GPUOpen-Tools
3+
Copyright (c) 2021 GPUOpen-Tools
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NOTICES.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Third-party licenses, acknowledgements
2+
======================================
3+
4+
isa_spec_manager uses the following third-party software:
5+
6+
**cxxopts**
7+
8+
Copyright (c) 2014 Jarryd Beck
9+
10+
Permission is hereby granted, free of charge, to any person obtaining a copy
11+
of this software and associated documentation files (the "Software"), to deal
12+
in the Software without restriction, including without limitation the rights
13+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
copies of the Software, and to permit persons to whom the Software is
15+
furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included in
18+
all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26+
THE SOFTWARE.
27+
28+
**nlohmann/json**
29+
30+
Copyright © 2013-2018 Niels Lohmann
31+
32+
**TinyXML-2**
33+
34+
TinyXML-2 is released under the zlib license:
35+
36+
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
37+
38+
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
39+
40+
The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
41+
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
42+
This notice may not be removed or altered from any source distribution.
43+

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
# isa_spec_manager
1+
# isa_spec_manager
2+
A set of tools for parsing and using AMD's machine-readable GPU ISA specifications.
3+
4+
The `IsaDecoder` API makes it easy to parse the specification XML files, decode instructions and even decode whole shaders.
5+
6+
For usage examples, see the [examples subfolder](https://github.com/GPUOpen-Tools/isa_spec_manager/tree/main/source/examples).
7+
8+
## Building isa_spec_manager
9+
To build the project, use the build scripts located in the ./build subfolder. Please note that the build process requires CMake with minimum version of 3.0.
10+
11+
### Building on Linux
12+
```
13+
cd ./isa_spec_manager/build
14+
./prebuild_linux.sh
15+
cd linux
16+
make
17+
```
18+
19+
The above script will launch the cmake. The script will generate projects directory.
20+
21+
### Building on Windows
22+
```
23+
cd ./isa_spec_manager/build
24+
./prebuild_windows.bat
25+
```
26+
27+
The above script will create a windows directory and generate a solution for Visual Studio.
28+
29+
## Using the API
30+
The following example files can give you a quick overview of how to start using the XML ISA spec in your project:
31+
* Basic usage example: [./source/examples/basic_decoder.cpp](./source/examples/basic_decoder.cpp)
32+
* Usage example with multiple architectures in flight: [./source/examples/multi_arch_decoder.cpp](./source/examples/multi_arch_decoder.cpp)
33+
34+
## Getting the ISA specification files
35+
The Machine-Readable GPU ISA specification files can be downloaded from [AMD's Machine-Readable GPU ISA Specification page on GPUOpen.com](https://gpuopen.com/machine-readable-isa/).

RELEASE_NOTES.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AMD's Machine-Readable ISA Specification and Tools - Release Notes #
2+
3+
## Highlights of this release ##
4+
5+
AMD's machine-readable GPU Instruction Set Architecture specifications is a set of XML files that describe AMD's latest GPU ISA: instructions, encodings, operands, data formats and even human-readable description strings.
6+
7+
The first release includes the specification XML files for the following GPU architectures:
8+
* AMD CDNA™ 3 (Instinct™ MI300)
9+
* AMD CDNA™ 2 (Instinct™ MI200)
10+
* AMD CDNA™ 1 (Instinct™ MI100)
11+
* AMD RDNA™ 3
12+
* AMD RDNA™ 2
13+
* AMD RDNA™ 1
14+
15+
The XML files can be downloaded from [GPUOpen.com](https://gpuopen.com/machine-readable-isa/).
16+
17+
This codebase includes the `IsaDecoder` API that can be used to decode, which can be used to decode AMD ISA assembly and disassembly using the specifications:
18+
* Load XML specification files and automatically parse them, so you don't need to write your own parser.
19+
* Decode single instructions and whole kernels and shaders in binary or text format.
20+
* Handle multiple architectures in flight with the `DecodeManager` convenience API.
21+
22+
For usage examples and instructions on how to build the project, please see [source/examples subdirectory on the isa_spec_manager GitHub repository](https://github.com/GPUOpen-Tools/isa_spec_manager).
23+
24+
**Note:** while the `IsaDecoder` API is a good way to get started with parsing the XML files, nothing prevents you from parsing the files yourself and building your own custom workflow. To do that please refer to the XML schema documentation [XML schema documentation](https://github.com/GPUOpen-Tools/isa_spec_manager/main/spec_documentation.md).
25+
26+
## Known issues ##
27+
28+
### Specification ###
29+
* Information about encoding modifiers is not provided in the specification.
30+
31+
### API and tools ###
32+
33+
* Decoding of MIMG instructions (such as IMAGE_STORE and IMAGE_LOAD) may produce the wrong register indices for source vector register operands.
34+

_clang-format

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
BasedOnStyle: Google
2+
IndentWidth: 4
3+
UseTab: Never
4+
ColumnLimit: 160
5+
6+
Language: Cpp
7+
AccessModifierOffset: -4
8+
BreakBeforeBraces: Custom
9+
BraceWrapping:
10+
AfterCaseLabel: true
11+
AfterClass: true
12+
AfterControlStatement: true
13+
AfterEnum: true
14+
AfterFunction: true
15+
AfterNamespace: true
16+
AfterObjCDeclaration: true
17+
AfterStruct: true
18+
AfterUnion: true
19+
AfterExternBlock: false
20+
BeforeCatch: true
21+
BeforeElse: true
22+
IndentBraces: false
23+
SplitEmptyFunction: true
24+
SplitEmptyRecord: true
25+
SplitEmptyNamespace: true
26+
ConstructorInitializerAllOnOneLineOrOnePerLine : false
27+
BreakConstructorInitializers: BeforeComma
28+
DerivePointerAlignment: false
29+
IndentCaseLabels: false
30+
NamespaceIndentation: All
31+
AlignConsecutiveAssignments: true
32+
AlignConsecutiveDeclarations: true
33+
AlignEscapedNewlines: Left
34+
AlignTrailingComments: true
35+
AlignOperands: true
36+
AllowShortFunctionsOnASingleLine: false
37+
AllowShortIfStatementsOnASingleLine: false
38+
AllowShortLoopsOnASingleLine: false
39+
AllowShortBlocksOnASingleLine: false
40+
ReflowComments: false
41+
SortIncludes: false
42+
SortUsingDeclarations: false
43+
BinPackArguments: false
44+
BinPackParameters: false
45+
ExperimentalAutoDetectBinPacking: false
46+
AllowAllParametersOfDeclarationOnNextLine: false

build/prebuild_linux.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# Set some defaults.
3+
BUILD_DIR="linux"
4+
5+
# Create build directory.
6+
if [ ! -d $BUILD_DIR ]; then
7+
mkdir $BUILD_DIR
8+
fi
9+
10+
# Run cmake.
11+
cd $BUILD_DIR
12+
cmake ../../
13+

build/prebuild_windows.bat

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
@echo off
2+
:: prebuild.bat --vs 2019
3+
SETLOCAL
4+
5+
rem Print help message
6+
if "%1"=="-h" goto :print_help
7+
if "%1"=="-help" goto :print_help
8+
if "%1"=="--h" goto :print_help
9+
if "%1"=="--help" goto :print_help
10+
if "%1"=="/?" goto :print_help
11+
12+
goto :start
13+
14+
:print_help
15+
echo:
16+
echo This script generates Visual Studio project and solution files for IsaSpecManager on Windows.
17+
echo:
18+
echo Usage: prebuild.bat ^[options^]
19+
echo:
20+
echo Options:
21+
echo --cmake Path to cmake executable to use. If not specified, the cmake from PATH env variable will be used.
22+
echo --vs Microsoft Visual Studio version. Currently supported values are: "2015", "2017", "2019" and "2022". The default is "2019".
23+
echo:
24+
echo Examples:
25+
echo prebuild.bat
26+
echo prebuild.bat --vs 2017
27+
28+
goto :exit
29+
30+
:start
31+
set SCRIPT_DIR=%~dp0
32+
set CURRENT_DIR=%CD%
33+
34+
rem Default values
35+
set CMAKE_PATH=cmake
36+
set VS_VER=2019
37+
set TEST=-DTEST_PROJECT=ON
38+
set BUILD_INTERNAL=-DBuildInternal=OFF
39+
40+
:begin
41+
if [%1]==[] goto :start_cmake
42+
if "%1"=="--no-test" goto :set_notest_flag
43+
if "%1"=="--public-only" goto :set_public_build_flag
44+
if "%1"=="--cmake" goto :set_cmake
45+
if "%1"=="--vs" goto :set_vs
46+
if "%1"=="--internal" goto :set_internal_build_flag
47+
goto :bad_arg
48+
49+
:set_notest_flag
50+
goto :start_cmake
51+
52+
:set_internal_build_flag
53+
goto :start_cmake
54+
55+
:set_cmake
56+
set CMAKE_PATH=%2
57+
goto :shift_2args
58+
59+
:set_vs
60+
set VS_VER=%2
61+
goto :shift_2args
62+
63+
:set_verbose
64+
@echo on
65+
goto :shift_arg
66+
67+
:shift_2args
68+
rem Shift to the next pair of arguments
69+
shift
70+
:shift_arg
71+
shift
72+
goto :begin
73+
74+
:bad_arg
75+
echo Error: Unexpected argument: %1%. Aborting...
76+
exit /b 1
77+
78+
:start_cmake
79+
set CMAKE_VSARCH=
80+
if "%VS_VER%"=="2015" (
81+
set CMAKE_VS="Visual Studio 14 2015 Win64"
82+
) else (
83+
if "%VS_VER%"=="2017" (
84+
set CMAKE_VS="Visual Studio 15 2017 Win64"
85+
) else (
86+
if "%VS_VER%"=="2019" (
87+
set CMAKE_VS="Visual Studio 16 2019"
88+
set CMAKE_VSARCH=-A x64
89+
) else (
90+
if "%VS_VER%"=="2022" (
91+
set CMAKE_VS="Visual Studio 17 2022"
92+
set CMAKE_VSARCH=-A x64
93+
) else (
94+
echo Error: Unknown VisualStudio version provided. Aborting...
95+
exit /b 1
96+
)
97+
)
98+
)
99+
)
100+
101+
rem Create an output folder
102+
set VS_FOLDER=VS%VS_VER%
103+
set OUTPUT_FOLDER=%SCRIPT_DIR%windows\%VS_FOLDER%
104+
if not exist %OUTPUT_FOLDER% (
105+
mkdir %OUTPUT_FOLDER%
106+
)
107+
108+
rem Invoke cmake with required arguments.
109+
echo:
110+
echo Running cmake to generate a VisualStudio solution...
111+
cd %OUTPUT_FOLDER%
112+
%CMAKE_PATH% -G %CMAKE_VS% %CMAKE_VSARCH% ..\..\..
113+
if not %ERRORLEVEL%==0 (
114+
echo "ERROR: cmake failed. Aborting..."
115+
exit /b 1
116+
)
117+
cd %CURRENT_DIR%
118+
echo Done.

0 commit comments

Comments
 (0)