Add 'projects/rocprofiler-sdk/' from commit 'bf0fad1d5406fbc51403ba1aa9621a9d4a9bce2b'
git-subtree-dir: projects/rocprofiler-sdk git-subtree-mainline:50a90550e9git-subtree-split:bf0fad1d54
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
resources:
|
||||
repositories:
|
||||
- repository: pipelines_repo
|
||||
type: github
|
||||
endpoint: ROCm
|
||||
name: ROCm/ROCm
|
||||
|
||||
variables:
|
||||
- group: common
|
||||
- template: /.azuredevops/variables-global.yml@pipelines_repo
|
||||
|
||||
trigger:
|
||||
batch: true
|
||||
branches:
|
||||
include:
|
||||
- amd-staging
|
||||
- amd-mainline
|
||||
paths:
|
||||
exclude:
|
||||
- .github
|
||||
- ISSUE_TEMPLATE
|
||||
- '*.md'
|
||||
- CODEOWNERS
|
||||
- LICENSE
|
||||
|
||||
pr:
|
||||
autoCancel: true
|
||||
branches:
|
||||
include:
|
||||
- amd-staging
|
||||
- amd-mainline
|
||||
paths:
|
||||
exclude:
|
||||
- .github
|
||||
- ISSUE_TEMPLATE
|
||||
- '*.md'
|
||||
- CODEOWNERS
|
||||
- LICENSE
|
||||
drafts: false
|
||||
|
||||
jobs:
|
||||
- template: ${{ variables.CI_COMPONENT_PATH }}/rocprofiler-sdk.yml@pipelines_repo
|
||||
@@ -0,0 +1,114 @@
|
||||
# clang-format v11
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: true
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveBitFields: true
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: TopLevel
|
||||
AlwaysBreakAfterReturnType: TopLevel
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: false
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: true
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 0
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeBlocks: Preserve
|
||||
IndentCaseLabels: true
|
||||
IndentCaseBlocks: false
|
||||
IndentFunctionDeclarationAfterType: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentExternBlock: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: Never
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
Checks: "-*,\
|
||||
misc-*,\
|
||||
-misc-incorrect-roundings,\
|
||||
-misc-macro-parentheses,\
|
||||
-misc-misplaced-widening-cast,\
|
||||
-misc-static-assert,\
|
||||
-misc-no-recursion,\
|
||||
-misc-non-private-member-variables-in-classes,\
|
||||
-misc-include-cleaner,\
|
||||
-misc-const-correctness,\
|
||||
modernize-*,\
|
||||
-modernize-deprecated-headers,\
|
||||
-modernize-raw-string-literal,\
|
||||
-modernize-return-braced-init-list,\
|
||||
-modernize-use-transparent-functors,\
|
||||
-modernize-use-trailing-return-type,\
|
||||
-modernize-avoid-c-arrays,\
|
||||
-modernize-redundant-void-arg,\
|
||||
-modernize-use-using,\
|
||||
-modernize-use-auto,\
|
||||
-modernize-concat-nested-namespaces,\
|
||||
-modernize-use-nodiscard,\
|
||||
-modernize-macro-to-enum,\
|
||||
-modernize-type-traits,\
|
||||
performance-*,\
|
||||
-performance-enum-size,\
|
||||
readability-*,\
|
||||
-readability-function-size,\
|
||||
-readability-identifier-naming,\
|
||||
-readability-implicit-bool-cast,\
|
||||
-readability-inconsistent-declaration-parameter-name,\
|
||||
-readability-named-parameter,\
|
||||
-readability-magic-numbers,\
|
||||
-readability-redundant-declaration,\
|
||||
-readability-redundant-member-init,\
|
||||
-readability-simplify-boolean-expr,\
|
||||
-readability-uppercase-literal-suffix,\
|
||||
-readability-braces-around-statements,\
|
||||
-readability-avoid-const-params-in-decls,\
|
||||
-readability-else-after-return,\
|
||||
-readability-isolate-declaration,\
|
||||
-readability-redundant-string-cstr,\
|
||||
-readability-static-accessed-through-instance,\
|
||||
-readability-const-return-type,\
|
||||
-readability-redundant-access-specifiers,\
|
||||
-readability-function-cognitive-complexity,\
|
||||
-readability-identifier-length,\
|
||||
-readability-use-anyofallof,\
|
||||
"
|
||||
CheckOptions:
|
||||
- key: readability-braces-around-statements.ShortStatementLines
|
||||
value: '2'
|
||||
- key: readability-implicit-bool-conversion.AllowPointerConditions
|
||||
value: '1'
|
||||
...
|
||||
@@ -0,0 +1,327 @@
|
||||
parse:
|
||||
additional_commands:
|
||||
rocprofiler_checkout_git_submodule:
|
||||
flags:
|
||||
- RECURSIVE
|
||||
kwargs:
|
||||
RELATIVE_PATH: '*'
|
||||
WORKING_DIRECTORY: '*'
|
||||
TEST_FILE: '*'
|
||||
REPO_URL: '*'
|
||||
REPO_BRANCH: '*'
|
||||
ADDITIONAL_COMMANDS: '*'
|
||||
rocprofiler_save_variables:
|
||||
kwargs:
|
||||
VARIABLES: '*'
|
||||
CONDITION: '*'
|
||||
rocprofiler_restore_variables:
|
||||
kwargs:
|
||||
VARIABLES: '*'
|
||||
CONDITION: '*'
|
||||
rocprofiler_target_compile_options:
|
||||
flags:
|
||||
- BUILD_INTERFACE
|
||||
- FORCE
|
||||
kwargs:
|
||||
PUBLIC: '*'
|
||||
PRIVATE: '*'
|
||||
INTERFACE: '*'
|
||||
LANGUAGES: '*'
|
||||
LINK_LANGUAGES: '*'
|
||||
rocprofiler_add_test:
|
||||
flags:
|
||||
- SKIP_BASELINE
|
||||
- SKIP_SAMPLING
|
||||
- SKIP_REWRITE
|
||||
- SKIP_RUNTIME
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
TARGET: '*'
|
||||
MPI: '*'
|
||||
GPU: '*'
|
||||
NUM_PROCS: '*'
|
||||
REWRITE_TIMEOUT: '*'
|
||||
RUNTIME_TIMEOUT: '*'
|
||||
SAMPLING_TIMEOUT: '*'
|
||||
SAMPLING_ARGS: '*'
|
||||
REWRITE_ARGS: '*'
|
||||
RUNTIME_ARGS: '*'
|
||||
RUN_ARGS: '*'
|
||||
ENVIRONMENT: '*'
|
||||
LABELS: '*'
|
||||
PROPERTIES: '*'
|
||||
SAMPLING_PASS_REGEX: '*'
|
||||
SAMPLING_FAIL_REGEX: '*'
|
||||
RUNTIME_PASS_REGEX: '*'
|
||||
RUNTIME_FAIL_REGEX: '*'
|
||||
REWRITE_PASS_REGEX: '*'
|
||||
REWRITE_FAIL_REGEX: '*'
|
||||
BASELINE_PASS_REGEX: '*'
|
||||
BASELINE_FAIL_REGEX: '*'
|
||||
REWRITE_RUN_PASS_REGEX: '*'
|
||||
REWRITE_RUN_FAIL_REGEX: '*'
|
||||
rocprofiler_add_causal_test:
|
||||
flags:
|
||||
- SKIP_BASELINE
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
TARGET: '*'
|
||||
CAUSAL_TIMEOUT: '*'
|
||||
CAUSAL_VALIDATE_TIMEOUT: '*'
|
||||
CAUSAL_MODE: '*'
|
||||
CAUSAL_ARGS: '*'
|
||||
CAUSAL_VALIDATE_ARGS: '*'
|
||||
RUNTIME_ARGS: '*'
|
||||
RUN_ARGS: '*'
|
||||
ENVIRONMENT: '*'
|
||||
LABELS: '*'
|
||||
PROPERTIES: '*'
|
||||
CAUSAL_PASS_REGEX: '*'
|
||||
CAUSAL_FAIL_REGEX: '*'
|
||||
BASELINE_PASS_REGEX: '*'
|
||||
BASELINE_FAIL_REGEX: '*'
|
||||
CAUSAL_VALIDATE_PASS_REGEX: '*'
|
||||
CAUSAL_VALIDATE_FAIL_REGEX: '*'
|
||||
rocprofiler_target_compile_definitions:
|
||||
kwargs:
|
||||
PUBLIC: '*'
|
||||
PRIVATE: '*'
|
||||
INTERFACE: '*'
|
||||
rocprofiler_add_bin_test:
|
||||
flags:
|
||||
- WILL_FAIL
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
ARGS: '*'
|
||||
LABELS: '*'
|
||||
TARGET: '*'
|
||||
DEPENDS: '*'
|
||||
COMMAND: '*'
|
||||
TIMEOUT: '*'
|
||||
PROPERTIES: '*'
|
||||
ENVIRONMENT: '*'
|
||||
WORKING_DIRECTORY: '*'
|
||||
PASS_REGEX: '*'
|
||||
FAIL_REGEX: '*'
|
||||
SKIP_REGEX: '*'
|
||||
rocprofiler_add_python_test:
|
||||
flags:
|
||||
- STANDALONE
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
FILE: '*'
|
||||
TIMEOUT: '*'
|
||||
PROFILE_ARGS: '*'
|
||||
RUN_ARGS: '*'
|
||||
ENVIRONMENT: '*'
|
||||
LABELS: '*'
|
||||
DEPENDS: '*'
|
||||
COMMAND: '*'
|
||||
PROPERTIES: '*'
|
||||
PYTHON_EXECUTABLE: '*'
|
||||
PYTHON_VERSION: '*'
|
||||
PASS_REGEX: '*'
|
||||
FAIL_REGEX: '*'
|
||||
SKIP_REGEX: '*'
|
||||
rocprofiler_add_python_validation_test:
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
ARGS: '*'
|
||||
PERFETTO_FILE: '*'
|
||||
PERFETTO_METRIC: '*'
|
||||
TIMEMORY_FILE: '*'
|
||||
TIMEMORY_METRIC: '*'
|
||||
rocm_version_message:
|
||||
flags:
|
||||
- STATUS
|
||||
- WARNING
|
||||
- SEND_ERROR
|
||||
- FATAL_ERROR
|
||||
- AUTHOR_WARNING
|
||||
rocprofiler_find_python:
|
||||
flags:
|
||||
- REQUIRED
|
||||
- QUIET
|
||||
kwargs:
|
||||
VERSION: '*'
|
||||
ROOT_DIR: '*'
|
||||
COMPONENTS: '*'
|
||||
rocprofiler_python_console_script:
|
||||
kwargs:
|
||||
VERSION: '*'
|
||||
ROOT_DIR: '*'
|
||||
rocprofiler_pybind11_add_module:
|
||||
flags:
|
||||
- MODULE
|
||||
- SHARED
|
||||
- EXCLUDE_FROM_ALL
|
||||
- NO_EXTRAS
|
||||
- SYSTEM
|
||||
- THIN_LTO
|
||||
- LTO
|
||||
kwargs:
|
||||
PYTHON_VERSION: '*'
|
||||
CXX_STANDARD: '*'
|
||||
VISIBILITY: '*'
|
||||
rocprofiler_directory:
|
||||
flags:
|
||||
- MKDIR
|
||||
- FAIL
|
||||
kwargs:
|
||||
PREFIX: '*'
|
||||
OUTPUT_VARIABLE: '*'
|
||||
WORKING_DIRECTORY: '*'
|
||||
PATHS: '*'
|
||||
rocprofiler_check_python_dirs_and_versions:
|
||||
flags:
|
||||
- UNSET
|
||||
- FAIL
|
||||
kwargs:
|
||||
RESULT_VARIABLE: '*'
|
||||
OUTPUT_VARIABLE: '*'
|
||||
rocprofiler_find_static_library:
|
||||
flags:
|
||||
- NO_CACHE
|
||||
- REQUIRED
|
||||
- NO_DEFAULT_PATH
|
||||
- NO_PACKAGE_ROOT_PATH
|
||||
- NO_CMAKE_PATH
|
||||
- NO_CMAKE_ENVIRONMENT_PATH
|
||||
- NO_SYSTEM_ENVIRONMENT_PATH
|
||||
- CMAKE_FIND_ROOT_PATH_BOTH
|
||||
- ONLY_CMAKE_FIND_ROOT_PATH
|
||||
- NO_CMAKE_FIND_ROOT_PATH
|
||||
kwargs:
|
||||
NAMES: '*'
|
||||
NAMES_PER_DIR: '*'
|
||||
HINTS: '*'
|
||||
PATHS: '*'
|
||||
PATH_SUFFIXES: '*'
|
||||
DOC: '*'
|
||||
rocprofiler_find_shared_library:
|
||||
flags:
|
||||
- NO_CACHE
|
||||
- REQUIRED
|
||||
- NO_DEFAULT_PATH
|
||||
- NO_PACKAGE_ROOT_PATH
|
||||
- NO_CMAKE_PATH
|
||||
- NO_CMAKE_ENVIRONMENT_PATH
|
||||
- NO_SYSTEM_ENVIRONMENT_PATH
|
||||
- CMAKE_FIND_ROOT_PATH_BOTH
|
||||
- ONLY_CMAKE_FIND_ROOT_PATH
|
||||
- NO_CMAKE_FIND_ROOT_PATH
|
||||
kwargs:
|
||||
NAMES: '*'
|
||||
NAMES_PER_DIR: '*'
|
||||
HINTS: '*'
|
||||
PATHS: '*'
|
||||
PATH_SUFFIXES: '*'
|
||||
DOC: '*'
|
||||
rocprofiler_causal_example_executable:
|
||||
kwargs:
|
||||
TAG: '*'
|
||||
SOURCES: '*'
|
||||
DEFINITIONS: '*'
|
||||
LINK_LIBRARIES: '*'
|
||||
INCLUDE_DIRECTORIES: '*'
|
||||
rocprofiler_add_validation_test:
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
ARGS: '*'
|
||||
LABELS: '*'
|
||||
TIMEOUT: '*'
|
||||
DEPENDS: '*'
|
||||
PROPERTIES: '*'
|
||||
PASS_REGEX: '*'
|
||||
FAIL_REGEX: '*'
|
||||
SKIP_REGEX: '*'
|
||||
ENVIRONMENT: '*'
|
||||
PERFETTO_FILE: '*'
|
||||
PERFETTO_METRIC: '*'
|
||||
TIMEMORY_FILE: '*'
|
||||
TIMEMORY_METRIC: '*'
|
||||
rocprofiler_configure_pytest_files:
|
||||
kwargs:
|
||||
COPY: '*'
|
||||
CONFIG: '*'
|
||||
OUTPUT_DIRECTORY: '*'
|
||||
rocprofiler_install_env_setup_files:
|
||||
kwargs:
|
||||
NAME: '*'
|
||||
VERSION: '*'
|
||||
SOURCE_DIR: '*'
|
||||
BINARY_DIR: '*'
|
||||
INSTALL_DIR: '*'
|
||||
COMPONENT: '*'
|
||||
rocprofiler_sdk_custom_compilation:
|
||||
flags:
|
||||
- GLOBAL
|
||||
- PROJECT
|
||||
kwargs:
|
||||
COMPILER: '*'
|
||||
DIRECTORY: '*'
|
||||
TARGET: '*'
|
||||
SOURCE: '*'
|
||||
override_spec: {}
|
||||
vartags: []
|
||||
proptags: []
|
||||
format:
|
||||
disable: false
|
||||
line_width: 90
|
||||
tab_size: 4
|
||||
use_tabchars: false
|
||||
fractional_tab_policy: use-space
|
||||
max_subgroups_hwrap: 2
|
||||
max_pargs_hwrap: 8
|
||||
max_rows_cmdline: 2
|
||||
separate_ctrl_name_with_space: false
|
||||
separate_fn_name_with_space: false
|
||||
dangle_parens: false
|
||||
dangle_align: child
|
||||
min_prefix_chars: 4
|
||||
max_prefix_chars: 10
|
||||
max_lines_hwrap: 2
|
||||
line_ending: unix
|
||||
command_case: lower
|
||||
keyword_case: upper
|
||||
always_wrap: []
|
||||
enable_sort: true
|
||||
autosort: false
|
||||
require_valid_layout: false
|
||||
layout_passes: {}
|
||||
markup:
|
||||
bullet_char: '*'
|
||||
enum_char: .
|
||||
first_comment_is_literal: true
|
||||
literal_comment_pattern: ^#
|
||||
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
|
||||
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
|
||||
explicit_trailing_pattern: '#<'
|
||||
hashruler_min_length: 10
|
||||
canonicalize_hashrulers: true
|
||||
enable_markup: true
|
||||
lint:
|
||||
disabled_codes: []
|
||||
function_pattern: '[0-9a-z_]+'
|
||||
macro_pattern: '[0-9A-Z_]+'
|
||||
global_var_pattern: '[A-Z][0-9A-Z_]+'
|
||||
internal_var_pattern: _[A-Z][0-9A-Z_]+
|
||||
local_var_pattern: '[a-z][a-z0-9_]+'
|
||||
private_var_pattern: _[0-9a-z_]+
|
||||
public_var_pattern: '[A-Z][0-9A-Z_]+'
|
||||
argument_var_pattern: '[a-z][a-z0-9_]+'
|
||||
keyword_pattern: '[A-Z][0-9A-Z_]+'
|
||||
max_conditionals_custom_parser: 2
|
||||
min_statement_spacing: 1
|
||||
max_statement_spacing: 2
|
||||
max_returns: 6
|
||||
max_branches: 12
|
||||
max_arguments: 5
|
||||
max_localvars: 15
|
||||
max_statements: 50
|
||||
encode:
|
||||
emit_byteorder_mark: false
|
||||
input_encoding: utf-8
|
||||
output_encoding: utf-8
|
||||
misc:
|
||||
per_command: {}
|
||||
@@ -0,0 +1,16 @@
|
||||
[flake8]
|
||||
max-line-length =
|
||||
90
|
||||
ignore =
|
||||
E203,
|
||||
E501,
|
||||
W503,
|
||||
W605,
|
||||
exclude =
|
||||
.git,
|
||||
__pycache__,
|
||||
scripts,
|
||||
external,
|
||||
tests,
|
||||
build,
|
||||
build-*
|
||||
@@ -0,0 +1,17 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "pip" # See documentation for possible values
|
||||
directory: "/docs/sphinx" # Location of package manifests
|
||||
open-pull-requests-limit: 10
|
||||
schedule:
|
||||
interval: "daily"
|
||||
versioning-strategy: increase
|
||||
@@ -0,0 +1,5 @@
|
||||
disabled: false
|
||||
scmId: gh-emu-rocm
|
||||
branchesToScan:
|
||||
- amd-staging
|
||||
- amd-mainline
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
# PR Details
|
||||
|
||||
## Associated Jira Ticket Number/Link
|
||||
|
||||
## What type of PR is this? (check all applicable)
|
||||
|
||||
- [ ] Refactor
|
||||
- [ ] Feature
|
||||
- [ ] Bug Fix
|
||||
- [ ] Optimization
|
||||
- [ ] Documentation Update
|
||||
- [ ] Continuous Integration
|
||||
|
||||
## Technical details
|
||||
|
||||
<!-- Please explain the changes along with JIRA/Github link(if applies). -->
|
||||
|
||||
## Added/updated tests?
|
||||
|
||||
<!-- We encourage you to keep the code coverage percentage at 80% and above. -->
|
||||
|
||||
- [ ] Yes
|
||||
- [ ] No, Does not apply to this PR.
|
||||
|
||||
## Updated CHANGELOG?
|
||||
|
||||
<!-- Needed for Release updates for a ROCm release. -->
|
||||
|
||||
- [ ] Yes
|
||||
- [ ] No, Does not apply to this PR.
|
||||
|
||||
## Added/Updated documentation?
|
||||
|
||||
- [ ] Yes
|
||||
- [ ] No, Does not apply to this PR.
|
||||
@@ -0,0 +1,332 @@
|
||||
name: Code Coverage
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-staging, amd-mainline ]
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- '**/README.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- '**/README.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
|
||||
ROCM_PATH: "/opt/rocm"
|
||||
GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201"
|
||||
PATH: "/usr/bin:$PATH"
|
||||
## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake
|
||||
## A task should be assigned directly to fix the issue
|
||||
## Scratch memory tests need to be fixed for ROCm 7.0 release
|
||||
navi3_EXCLUDE_TESTS_REGEX: ""
|
||||
vega20_EXCLUDE_TESTS_REGEX: ""
|
||||
mi200_EXCLUDE_TESTS_REGEX: ""
|
||||
mi300_EXCLUDE_TESTS_REGEX: ""
|
||||
mi300a_EXCLUDE_TESTS_REGEX: ""
|
||||
mi325_EXCLUDE_TESTS_REGEX: ""
|
||||
mi3xx_EXCLUDE_TESTS_REGEX: ""
|
||||
navi4_EXCLUDE_TESTS_REGEX: ""
|
||||
navi3_EXCLUDE_LABEL_REGEX: ""
|
||||
vega20_EXCLUDE_LABEL_REGEX: ""
|
||||
mi200_EXCLUDE_LABEL_REGEX: ""
|
||||
mi300_EXCLUDE_LABEL_REGEX: ""
|
||||
mi300a_EXCLUDE_LABEL_REGEX: ""
|
||||
mi325_EXCLUDE_LABEL_REGEX: ""
|
||||
mi3xx_EXCLUDE_LABEL_REGEX: ""
|
||||
navi4_EXCLUDE_LABEL_REGEX: ""
|
||||
GLOBAL_CMAKE_OPTIONS: ""
|
||||
|
||||
jobs:
|
||||
code-coverage:
|
||||
if: ${{ contains(github.event_name, 'pull_request') }}
|
||||
strategy:
|
||||
# fail-fast: false
|
||||
matrix:
|
||||
runner: ['mi300a']
|
||||
os: ['ubuntu-22.04']
|
||||
build-type: ['Release']
|
||||
|
||||
runs-on: ${{ matrix.runner }}-emu-runner-set
|
||||
|
||||
# define this for containers
|
||||
env:
|
||||
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
||||
GCC_COMPILER_VERSION: 11
|
||||
ROCPROFILER_PC_SAMPLING_BETA_ENABLED: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Load Existing XML Code Coverage
|
||||
if: github.event_name == 'pull_request'
|
||||
id: load-coverage
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: ${{ github.event.pull_request.base.sha }}-codecov
|
||||
path: .codecov/**
|
||||
|
||||
- name: Copy Existing XML Code Coverage
|
||||
if: github.event_name == 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -d .codecov ]; then cp -r .codecov .codecov.ref; fi
|
||||
|
||||
- name: Configure Env
|
||||
shell: bash
|
||||
run: |
|
||||
echo "${PATH}:/usr/local/bin:${HOME}/.local/bin" >> $GITHUB_PATH
|
||||
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:${HOME}/.local/lib" >> $GITHUB_ENV
|
||||
|
||||
- name: Install requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
apt-get update
|
||||
apt-get install -y build-essential cmake python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev libsqlite3-dev
|
||||
python3 -m pip install -U --user -r requirements.txt
|
||||
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
|
||||
|
||||
- name: Sync gcov with compilers
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run:
|
||||
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} &&
|
||||
update-alternatives
|
||||
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 500
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }}
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
|
||||
|
||||
- name: List Files
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PATH: ${PATH}"
|
||||
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||||
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
|
||||
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
|
||||
cat /opt/rocm/.info/version
|
||||
ls -la
|
||||
|
||||
- name: Enable PC Sampling
|
||||
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
|
||||
|
||||
- name: Configure, Build, and Test (Total Code Coverage)
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run:
|
||||
python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--coverage all
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
--
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
|
||||
- name: Configure, Build, and Test (Tests Code Coverage)
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run:
|
||||
find build -type f | egrep '\.gcda$' | xargs rm &&
|
||||
python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-tests
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--coverage tests
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
--
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
|
||||
- name: Configure, Build, and Test (Samples Code Coverage)
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run:
|
||||
find build -type f | egrep '\.gcda$' | xargs rm &&
|
||||
python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-samples
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--coverage samples
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
--
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
|
||||
- name: Save XML Code Coverage
|
||||
id: save-coverage
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
key: ${{ github.sha }}-codecov
|
||||
path: |
|
||||
.codecov/*.xml
|
||||
|
||||
- id: generatereport
|
||||
name: Generate Code Coverage Comment
|
||||
if: github.event_name == 'pull_request'
|
||||
timeout-minutes: 5
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PWD: ${PWD}"
|
||||
ls -la
|
||||
|
||||
for i in "all" "tests" "samples"; do
|
||||
wkhtmltoimage --enable-local-file-access --quality 70 .codecov/${i}.html .codecov/${i}.png
|
||||
done
|
||||
ls -la .codecov
|
||||
which -a git
|
||||
git --version
|
||||
|
||||
./source/scripts/upload-image-to-github.py --bot --token ${{ secrets.TOKEN }} --files .codecov/{all,tests,samples}.png --output-dir .codecov --name pr-${{ github.event.pull_request.number }}
|
||||
|
||||
echo -e "\n${PWD}:"
|
||||
ls -la .
|
||||
|
||||
echo -e "\n.codecov:"
|
||||
ls -la .codecov
|
||||
|
||||
get-base-md-contents() { cat .codecov/${1}.png.md; }
|
||||
get-full-md-contents() { cat .codecov/${1}.png.md .codecov/${1}.md; }
|
||||
cat << EOF > .codecov/report.md
|
||||
# Code Coverage Report
|
||||
|
||||
## Tests Only
|
||||
$(get-base-md-contents tests)
|
||||
|
||||
## Samples Only
|
||||
$(get-base-md-contents samples)
|
||||
|
||||
## Tests + Samples
|
||||
$(get-base-md-contents all)
|
||||
|
||||
<!-- code-coverage-comment-identifier -->
|
||||
EOF
|
||||
|
||||
echo 'CODECOVERAGE_REPORT<<EOF' > $GITHUB_OUTPUT
|
||||
cat .codecov/report.md >> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Write Code Coverage Comment
|
||||
if: github.event_name == 'pull_request'
|
||||
timeout-minutes: 5
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
COMMENT_BODY: |
|
||||
<details>
|
||||
<summary><h2>Code Coverage Report</h2></summary>
|
||||
|
||||
<!-- Keep the empty line above to render markdown properly -->
|
||||
${{ steps.generatereport.outputs.CODECOVERAGE_REPORT }}
|
||||
</details>
|
||||
with:
|
||||
github-token: ${{ secrets.TOKEN }}
|
||||
script: |
|
||||
const commentIdentifier = '<!-- code-coverage-comment-identifier -->'; // Used to identify codecov comment
|
||||
const commentBody = process.env.COMMENT_BODY;
|
||||
|
||||
// Fetch existing comments
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.pull_request.number,
|
||||
});
|
||||
|
||||
// Check for an existing comment
|
||||
const existingComment = comments.find(comment => comment.body.includes(commentIdentifier));
|
||||
|
||||
if (existingComment) {
|
||||
// Update the existing comment
|
||||
await github.rest.issues.updateComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: existingComment.id,
|
||||
body: commentBody,
|
||||
});
|
||||
core.info(`Updated comment with ID: ${existingComment.id}`);
|
||||
} else {
|
||||
// Create a new comment
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.pull_request.number,
|
||||
body: commentBody,
|
||||
});
|
||||
core.info('Created a new comment.');
|
||||
}
|
||||
|
||||
- name: Archive Code Coverage Data
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: code-coverage-details
|
||||
path: |
|
||||
${{github.workspace}}/.codecov/*
|
||||
|
||||
- name: Verify Test Labels
|
||||
timeout-minutes: 5
|
||||
shell: bash
|
||||
run: |
|
||||
pushd build
|
||||
#
|
||||
# if following fails, there is a test that does not have
|
||||
# a label identifying it as sample or test (unit or integration).
|
||||
# Recommended labels are:
|
||||
# - samples
|
||||
# - unittests
|
||||
# - integration-tests
|
||||
#
|
||||
ctest -N -LE 'samples|tests' -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" -O ctest.mislabeled.log
|
||||
grep 'Total Tests: 0' ctest.mislabeled.log
|
||||
#
|
||||
# if following fails, then there is overlap between the labels.
|
||||
# A test cannot both be a sample and (unit/integration) test.
|
||||
#
|
||||
ctest -N -O ctest.all.log
|
||||
ctest -N -O ctest.samples.log -L samples
|
||||
ctest -N -O ctest.tests.log -L tests
|
||||
NUM_ALL=$(grep 'Total Tests:' ctest.all.log | awk '{print $NF}')
|
||||
NUM_SAMPLE=$(grep 'Total Tests:' ctest.samples.log | awk '{print $NF}')
|
||||
NUM_TEST=$(grep 'Total Tests:' ctest.tests.log | awk '{print $NF}')
|
||||
NUM_SUM=$((${NUM_SAMPLE} + ${NUM_TEST}))
|
||||
echo "Total tests: ${NUM_ALL}"
|
||||
echo "Total labeled tests: ${NUM_SUM}"
|
||||
if [ ${NUM_ALL} != ${NUM_SUM} ]; then
|
||||
echo "Test label overlap"
|
||||
exit 1
|
||||
fi
|
||||
popd
|
||||
@@ -0,0 +1,100 @@
|
||||
name: "CodeQL Advanced Analysis"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- amd-staging
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
|
||||
push:
|
||||
branches:
|
||||
- amd-staging
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
|
||||
env:
|
||||
ROCM_PATH: "/opt/rocm"
|
||||
GPU_TARGETS: "gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1201"
|
||||
PATH: "/usr/bin:$PATH"
|
||||
EXCLUDED_PATHS: "external /tmp/build/external"
|
||||
GLOBAL_CMAKE_OPTIONS: "-DROCPROFILER_INTERNAL_RCCL_API_TRACE=ON"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners (GitHub.com only)
|
||||
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
|
||||
container: rocm/dev-ubuntu-22.04:latest
|
||||
permissions:
|
||||
# required for all workflows
|
||||
security-events: write
|
||||
|
||||
# required to fetch internal or private CodeQL packs
|
||||
packages: read
|
||||
|
||||
# only required for workflows in private repositories
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: cpp
|
||||
build-mode: manual
|
||||
- language: python
|
||||
build-mode: none
|
||||
- language : actions
|
||||
build-mode: none
|
||||
steps:
|
||||
- name: Install requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y software-properties-common
|
||||
sudo apt-add-repository ppa:git-core/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rocdecode-dev rocjpeg-dev
|
||||
git config --global --add safe.directory '*'
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
queries: security-extended
|
||||
|
||||
- name: Configure and Build
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install -r requirements.txt
|
||||
cmake -B /tmp/build -DCMAKE_PREFIX_PATH=/opt/rocm ${{ env.GLOBAL_CMAKE_OPTIONS }} -DPython3_EXECUTABLE=$(which python3) .
|
||||
cmake --build /tmp/build --target all --parallel 16
|
||||
rm -rf ${EXCLUDED_PATHS}
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
@@ -0,0 +1,321 @@
|
||||
name: Continuous Integration
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-staging, amd-mainline ]
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- '**/README.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- '**/README.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
|
||||
ROCM_PATH: "/opt/rocm"
|
||||
GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201"
|
||||
PATH: "/usr/bin:$PATH"
|
||||
## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake
|
||||
## A task should be assigned directly to fix the issue
|
||||
## Scratch memory tests need to be fixed for ROCm 7.0 release
|
||||
navi3_EXCLUDE_TESTS_REGEX: ""
|
||||
vega20_EXCLUDE_TESTS_REGEX: ""
|
||||
mi200_EXCLUDE_TESTS_REGEX: ""
|
||||
mi300_EXCLUDE_TESTS_REGEX: ""
|
||||
mi300a_EXCLUDE_TESTS_REGEX: ""
|
||||
mi325_EXCLUDE_TESTS_REGEX: ""
|
||||
mi3xx_EXCLUDE_TESTS_REGEX: ""
|
||||
navi4_EXCLUDE_TESTS_REGEX: ""
|
||||
navi3_EXCLUDE_LABEL_REGEX: ""
|
||||
vega20_EXCLUDE_LABEL_REGEX: ""
|
||||
mi200_EXCLUDE_LABEL_REGEX: ""
|
||||
mi300_EXCLUDE_LABEL_REGEX: ""
|
||||
mi300a_EXCLUDE_LABEL_REGEX: ""
|
||||
mi325_EXCLUDE_LABEL_REGEX: ""
|
||||
mi3xx_EXCLUDE_LABEL_REGEX: ""
|
||||
navi4_EXCLUDE_LABEL_REGEX: ""
|
||||
GLOBAL_CMAKE_OPTIONS: ""
|
||||
|
||||
jobs:
|
||||
core-deb:
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: ['navi3', 'navi4', 'mi300a']
|
||||
os: ['ubuntu-22.04']
|
||||
build-type: ['RelWithDebInfo']
|
||||
ci-flags: ['--linter clang-tidy']
|
||||
|
||||
runs-on: ${{ matrix.runner == 'mi3xx' && 'rocprof-azure' || matrix.runner }}-emu-runner-set
|
||||
|
||||
# define this for containers
|
||||
env:
|
||||
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
||||
CORE_EXT_RUNNER: mi3xx
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
apt-get update
|
||||
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
|
||||
python3 -m pip install -U --user -r requirements.txt
|
||||
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk* /opt/rocm*/lib/python*/site-packages/roctx /opt/rocm*/lib/python*/site-packages/rocpd
|
||||
|
||||
- name: List Files
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PATH: ${PATH}"
|
||||
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||||
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
|
||||
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
|
||||
cat /opt/rocm/.info/version
|
||||
ls -la
|
||||
|
||||
- name: Enable PC Sampling
|
||||
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
|
||||
|
||||
- name: Configure, Build, and Test
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run:
|
||||
python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
${{ matrix.ci-flags }}
|
||||
--
|
||||
-DROCPROFILER_DEP_ROCMCORE=ON
|
||||
-DROCPROFILER_BUILD_DOCS=OFF
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk
|
||||
-DCPACK_GENERATOR='DEB;RPM;TGZ'
|
||||
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
|
||||
- name: Install
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 10
|
||||
run:
|
||||
cmake --build build --target install --parallel 16
|
||||
|
||||
- name: Build Packaging
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 10
|
||||
run:
|
||||
cmake --build build --target package --parallel 16
|
||||
|
||||
- name: Test Install Build
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 20
|
||||
shell: bash
|
||||
run: |
|
||||
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples
|
||||
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests -DGPU_TARGETS="gfx942" tests
|
||||
export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH}
|
||||
cmake --build build-samples --target all --parallel 16
|
||||
cmake --build build-tests --target all --parallel 16
|
||||
ctest --test-dir build-samples -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-tests -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
|
||||
- name: Install Packages
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 5
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin
|
||||
ls -la
|
||||
ls -la ./build
|
||||
dpkg --force-all -i ./build/rocprofiler-sdk-roctx_*.deb
|
||||
dpkg --force-all -i ./build/rocprofiler-sdk-rocpd_*.deb
|
||||
for i in $(ls -S ./build/rocprofiler-sdk*.deb | egrep -v 'roctx|rocpd'); do dpkg --force-all -i ${i}; done;
|
||||
|
||||
- name: Test Installed Packages
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 20
|
||||
shell: bash
|
||||
run: |
|
||||
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-samples-deb /opt/rocm/share/rocprofiler-sdk/samples
|
||||
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb -DGPU_TARGETS="gfx942" /opt/rocm/share/rocprofiler-sdk/tests
|
||||
cmake --build build-samples-deb --target all --parallel 16
|
||||
cmake --build build-tests-deb --target all --parallel 16
|
||||
ctest --test-dir build-samples-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-tests-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
|
||||
- name: Archive production artifacts
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installers-deb
|
||||
path: |
|
||||
${{github.workspace}}/build/*.deb
|
||||
${{github.workspace}}/build/*.rpm
|
||||
${{github.workspace}}/build/*.tgz
|
||||
|
||||
core-rpm:
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: ['mi300']
|
||||
os: ['rhel', 'sles']
|
||||
build-type: ['RelWithDebInfo']
|
||||
ci-flags: ['']
|
||||
|
||||
runs-on: rocprof-azure-${{ matrix.os }}-emu-runner-set
|
||||
|
||||
# define this for containers
|
||||
env:
|
||||
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
||||
OS_TYPE: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
if [ "${OS_TYPE}" == "rhel" ]; then
|
||||
dnf makecache
|
||||
dnf groupinstall -y "Development Tools"
|
||||
dnf remove -y gcc-c++
|
||||
dnf install -y gcc-toolset-11-gcc-c++ llvm14-devel
|
||||
fi
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install -U --user -r requirements.txt
|
||||
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
|
||||
|
||||
- name: List Files
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PATH: ${PATH}"
|
||||
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||||
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
|
||||
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
|
||||
cat /opt/rocm/.info/version
|
||||
ls -la
|
||||
|
||||
- name: Enable PC Sampling
|
||||
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
|
||||
|
||||
- name: Configure, Build, and Test
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run:
|
||||
if [ "${OS_TYPE}" == "rhel" ]; then source scl_source enable gcc-toolset-11; fi;
|
||||
/usr/bin/python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
${{ matrix.ci-flags }}
|
||||
--
|
||||
-DROCPROFILER_DEP_ROCMCORE=ON
|
||||
-DROCPROFILER_BUILD_DOCS=OFF
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
|
||||
sanitizers:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: ['mi300']
|
||||
sanitizer: ['AddressSanitizer', 'ThreadSanitizer', 'LeakSanitizer', 'UndefinedBehaviorSanitizer']
|
||||
os: ['ubuntu-22.04']
|
||||
build-type: ['RelWithDebInfo']
|
||||
|
||||
if: ${{ contains(github.event_name, 'pull_request') }}
|
||||
runs-on: ${{ matrix.runner == 'mi3xx' && 'rocprof-azure' || matrix.runner }}-emu-runner-set
|
||||
|
||||
# define this for containers
|
||||
env:
|
||||
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
||||
GCC_COMPILER_VERSION: 13
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
apt-get update
|
||||
apt-get install -y build-essential cmake python3-pip libasan8 libtsan2 software-properties-common clang-15 libdw-dev libsqlite3-dev
|
||||
add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }}
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }} --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
|
||||
python3 -m pip install -U --user -r requirements.txt
|
||||
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
|
||||
|
||||
- name: List Files
|
||||
shell: bash
|
||||
run: |
|
||||
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
|
||||
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
|
||||
cat /opt/rocm/.info/version
|
||||
ls -la
|
||||
|
||||
- name: Enable PC Sampling
|
||||
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
|
||||
|
||||
- name: Configure, Build, and Test
|
||||
timeout-minutes: 45
|
||||
shell: bash
|
||||
run:
|
||||
python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-${{ matrix.sanitizer }}
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--memcheck ${{ matrix.sanitizer }}
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
--
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}"
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
@@ -0,0 +1,137 @@
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-staging, amd-mainline ]
|
||||
paths:
|
||||
- '*.md'
|
||||
- 'VERSION'
|
||||
- 'source/docs/**'
|
||||
- 'source/scripts/update-docs.sh'
|
||||
- 'source/include/rocprofiler-sdk/**'
|
||||
- '.github/workflows/docs.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- '*.md'
|
||||
- 'VERSION'
|
||||
- 'source/docs/**'
|
||||
- 'source/scripts/update-docs.sh'
|
||||
- 'source/include/rocprofiler-sdk/**'
|
||||
- '.github/workflows/docs.yml'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
||||
|
||||
jobs:
|
||||
build-docs:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
container: continuumio/miniconda3
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Create Docs Directory
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
mkdir -p docs/_doxygen/rocprofiler-sdk
|
||||
mkdir -p docs/_doxygen/roctx
|
||||
- name: Install documentation dependencies
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y doxygen graphviz build-essential cmake
|
||||
- name: Build Docs
|
||||
shell: bash -el {0}
|
||||
working-directory: source/docs
|
||||
run: |
|
||||
conda init
|
||||
conda env create -n rocprofiler-docs -f environment.yml
|
||||
conda activate rocprofiler-docs
|
||||
python3 -m pip install sphinx
|
||||
python3 -m pip install doxysphinx rocm-docs-core
|
||||
git config --global --add safe.directory '*'
|
||||
../scripts/update-docs.sh
|
||||
- name: Upload artifact
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./docs
|
||||
|
||||
deploy-docs:
|
||||
if: github.ref == 'refs/heads/amd-mainline'
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
needs: build-docs
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
build-docs-from-source:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
container: rocm/dev-ubuntu-22.04:latest
|
||||
steps:
|
||||
- name: Install os essentials
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y software-properties-common
|
||||
sudo apt-add-repository ppa:git-core/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Create Docs Directory
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
mkdir -p source/docs/_doxygen/rocprofiler-sdk
|
||||
mkdir -p source/docs/_doxygen/roctx
|
||||
- name: Install requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake gcc g++ libdw-dev libsqlite3-dev rpm
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
- name: Configure, Build, Install, and Package
|
||||
timeout-minutes: 60
|
||||
shell: bash
|
||||
run:
|
||||
git config --global --add safe.directory '*';
|
||||
export CMAKE_PREFIX_PATH=/opt/rocm:${CMAKE_PREFIX_PATH};
|
||||
cmake -B build
|
||||
-DROCPROFILER_DEP_ROCMCORE=ON
|
||||
-DROCPROFILER_BUILD_DOCS=ON
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk
|
||||
-DCPACK_GENERATOR='DEB;RPM;TGZ'
|
||||
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
.;
|
||||
cmake --build build --target docs --parallel 4;
|
||||
cmake --build build --target all --parallel 12;
|
||||
sudo cmake --build build --target install --parallel 12;
|
||||
cmake --build build --target package --parallel 12
|
||||
@@ -0,0 +1,143 @@
|
||||
|
||||
name: Formatting
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '.github/workflows/pull_*.yml'
|
||||
- '.github/workflows/linting.yml'
|
||||
- '.github/workflows/markdown_lint.yml'
|
||||
- '*.md'
|
||||
- '**/README.md'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
cmake:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
env:
|
||||
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip
|
||||
python3 -m pip install -U cmake-format
|
||||
|
||||
- name: Run cmake-format
|
||||
run: |
|
||||
set +e
|
||||
cmake-format -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
|
||||
if [ $(git diff | wc -l) -ne 0 ]; then
|
||||
echo -e "\nError! CMake code not formatted. Run cmake-format...\n"
|
||||
echo -e "\nFiles:\n"
|
||||
git diff --name-only
|
||||
echo -e "\nFull diff:\n"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
container: rocm/dev-ubuntu-22.04:latest
|
||||
env:
|
||||
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}')
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y software-properties-common python3 python3-pip build-essential
|
||||
sudo apt install -y wget curl clang-format-11
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Run clang-format
|
||||
run: |
|
||||
set +e
|
||||
FILES=$(find samples source tests benchmark -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
|
||||
FORMAT_OUT=$(clang-format-11 -i ${FILES})
|
||||
if [ $(git diff | wc -l) -ne 0 ]; then
|
||||
echo -e "\nError! Code not formatted. Run clang-format (version 11)...\n"
|
||||
echo -e "\nFiles:\n"
|
||||
git diff --name-only
|
||||
echo -e "\nFull diff:\n"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.10']
|
||||
env:
|
||||
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install black
|
||||
|
||||
- name: black format
|
||||
run: |
|
||||
black .
|
||||
if [ $(git diff | wc -l) -ne 0 ]; then
|
||||
echo -e "\nError! Python code not formatted. Run black...\n"
|
||||
echo -e "\nFiles:\n"
|
||||
git diff --name-only
|
||||
echo -e "\nFull diff:\n"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
missing-new-line:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Find missing new line
|
||||
shell: bash
|
||||
run: |
|
||||
OUTFILE=missing_newline.txt
|
||||
for i in $(find source tests samples benchmark docker cmake -type f | egrep -v '\.(bin|png|csv)$|source/docs/_(build|doxygen)'); do VAL=$(tail -c 1 ${i}); if [ -n "${VAL}" ]; then echo "- ${i}" >> ${OUTFILE}; fi; done
|
||||
if [[ -f ${OUTFILE} && $(cat ${OUTFILE} | wc -l) -gt 0 ]]; then
|
||||
echo -e "\nError! Source code missing new line at end of file...\n"
|
||||
echo -e "\nFiles:\n"
|
||||
cat ${OUTFILE}
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,70 @@
|
||||
name: Generate AFAR
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rocm-release:
|
||||
description: 'ROCm Release Version'
|
||||
required: true
|
||||
type: string
|
||||
build-number:
|
||||
description: 'ROCm CI Build Number'
|
||||
required: true
|
||||
type: string
|
||||
build-job-name:
|
||||
description: 'ROCm CI Build Job Name'
|
||||
required: true
|
||||
type: string
|
||||
rocprofiler-sdk-revision:
|
||||
description: 'ROCProfiler-SDK Commit Hash'
|
||||
default: 'amd-staging'
|
||||
required: true
|
||||
type: string
|
||||
extra-cmake-args:
|
||||
description: 'Extra Arguments to give to cmake configuration'
|
||||
required: false
|
||||
type: string
|
||||
package-types:
|
||||
description: 'Package types provided to `CPACK_GENERATOR`'
|
||||
required: true
|
||||
default: 'STGZ'
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
generate-packages-ubuntu-22:
|
||||
runs-on: rocprof-azure-emu-runner-set
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: '${{ inputs.rocprofiler-sdk-revision }}'
|
||||
path: 'rocprofiler-sdk'
|
||||
|
||||
- name: Install Requirements
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '${{github.workspace}}/*'
|
||||
apt-get update
|
||||
amdgpu-repo --rocm-build=${{ inputs.build-job-name }}/${{ inputs.build-number }}
|
||||
apt-get upgrade -y
|
||||
apt-get install -y build-essential cmake rocm-llvm-dev python3-pip libdw-dev libsqlite3-dev
|
||||
python3 -m pip install -r ${{github.workspace}}/rocprofiler-sdk/requirements.txt
|
||||
|
||||
- name: Building ROCProfiler-SDK Packages
|
||||
shell: bash
|
||||
run: |
|
||||
cmake -B build-rocprofiler-sdk -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/opt/rocm -DCPACK_GENERATOR="${{ inputs.package-types }}" -DROCPROFILER_BUILD_{TESTS,SAMPLES}=ON ${{ inputs.extra-cmake-args }} ${{github.workspace}}/rocprofiler-sdk
|
||||
cmake --build build-rocprofiler-sdk --parallel 16
|
||||
cmake --build build-rocprofiler-sdk --target package --parallel 16
|
||||
|
||||
- name: Archive Packages
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Packages-${{ inputs.rocm-release }}
|
||||
path: |
|
||||
${{github.workspace}}/build-*/*.sh
|
||||
${{github.workspace}}/build-*/*.deb
|
||||
${{github.workspace}}/build-*/*.rpm
|
||||
${{github.workspace}}/build-*/*.tar.gz
|
||||
@@ -0,0 +1,15 @@
|
||||
name: Rocm Validation Suite KWS
|
||||
on:
|
||||
push:
|
||||
branches: [amd-staging, amd-mainline]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
kws:
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/kws.yml@mainline
|
||||
secrets: inherit
|
||||
with:
|
||||
pr_number: ${{github.event.pull_request.number}}
|
||||
base_branch: ${{github.base_ref}}
|
||||
@@ -0,0 +1,39 @@
|
||||
name: Python Linting
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-staging, amd-mainline ]
|
||||
paths:
|
||||
- '**.py'
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.py'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
linting:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.8', '3.10', '3.12']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 source --count --show-source --statistics --select=E9,F63,F7,F82
|
||||
# flake8 options are defined in .flake8
|
||||
flake8 source --count --show-source --statistics
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
name: Code Restrictions
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# This workflow ensures that certain code restrictions are applied.
|
||||
# For examples, rocprofiler-sdk cannot use std::regex because of issues
|
||||
# when loaded into an application compiled with C++ dual ABI support because
|
||||
# while std::regex itself (and std::regex_traits) being ABI-tagged,
|
||||
# std::__detail::_Scanner is not. Applications compiled with dual ABI support
|
||||
# will either throw an exception or produce a segfault and thus, this workflow
|
||||
# attempts to catch usage of std::regex during CI.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '.github/workflows/pull_*.yml'
|
||||
- '.github/workflows/linting.yml'
|
||||
- '.github/workflows/markdown_lint.yml'
|
||||
- '*.md'
|
||||
- '**/README.md'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
regex:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
env:
|
||||
FOLDERS: "source/lib/common source/lib/rocprofiler-sdk source/lib/rocprofiler-sdk-roctx"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip
|
||||
python3 -m pip install -U cmake-format
|
||||
|
||||
- name: Apply restriction
|
||||
run: |
|
||||
set +e
|
||||
FILES="$(find ${FOLDERS} -type f)"
|
||||
GREP="$(grep -E -n 'std::regex|<regex>' ${FILES})"
|
||||
if [ "${GREP}" != "" ]; then
|
||||
echo -e "\nError! std::regex is not allowed in ${FOLDERS}...\n"
|
||||
echo -e "\nResults:\n"
|
||||
echo "${GREP}"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,25 @@
|
||||
name: ROCm CI Caller
|
||||
on:
|
||||
pull_request:
|
||||
branches: [amd-staging, release/rocm-rel-*]
|
||||
types: [opened, reopened, synchronize]
|
||||
push:
|
||||
branches: [amd-mainline]
|
||||
workflow_dispatch:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
call-workflow:
|
||||
if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest')))
|
||||
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline
|
||||
secrets: inherit
|
||||
with:
|
||||
input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}}
|
||||
input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}}
|
||||
input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}}
|
||||
input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}}
|
||||
repository_name: ${{ github.repository }}
|
||||
base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}}
|
||||
trigger_event_type: ${{ github.event_name }}
|
||||
comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
name: ROCm Release Compatibility
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-staging, amd-mainline ]
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- 'source/docs/**'
|
||||
- 'CODEOWNERS'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
ROCM_PATH: "/opt/rocm"
|
||||
PATH: "/usr/bin:$PATH"
|
||||
|
||||
jobs:
|
||||
rocm-release-compatibility:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
rocm-release: ['6.2', '6.3', '6.4', 'latest']
|
||||
os: ['ubuntu-22.04']
|
||||
build-type: ['Release']
|
||||
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
container:
|
||||
image: rocm/dev-${{ matrix.os }}:${{ matrix.rocm-release }}
|
||||
|
||||
# define this for containers
|
||||
env:
|
||||
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
||||
|
||||
steps:
|
||||
- name: Install Git
|
||||
timeout-minutes: 25
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y software-properties-common
|
||||
add-apt-repository -y ppa:git-core/ppa
|
||||
apt-get update
|
||||
apt-get install -y git
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install requirements
|
||||
if: ${{ matrix.rocm-release == '6.2' }}
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
apt-get update
|
||||
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
|
||||
python3 -m pip install -U --user -r requirements.txt
|
||||
|
||||
- name: Install requirements
|
||||
if: ${{ matrix.rocm-release != '6.2' }}
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
apt-get update
|
||||
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
|
||||
python3 -m pip install -U --user -r requirements.txt
|
||||
|
||||
- name: List Files
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Number of processors: $(nproc)"
|
||||
echo "PATH: ${PATH}"
|
||||
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||||
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
|
||||
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
|
||||
cat /opt/rocm/.info/version
|
||||
ls -la
|
||||
|
||||
- name: Configure and Build
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
run:
|
||||
python3 ./source/scripts/run-ci.py -B build
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-rocm-${{ matrix.rocm-release }}
|
||||
--build-jobs 4
|
||||
--site "$(hostname)"
|
||||
--stages Start Update Configure Build Submit
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
--disable-cdash
|
||||
--
|
||||
-DROCPROFILER_DEP_ROCMCORE=ON
|
||||
-DROCPROFILER_BUILD_{TESTS,SAMPLES,DOCS}=OFF
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DCMAKE_INSTALL_PREFIX="$(realpath /opt/rocm)"
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
|
||||
- name: Install
|
||||
timeout-minutes: 10
|
||||
run:
|
||||
cmake --build build --target install
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Sync amd-mainline to public repository
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-mainline ]
|
||||
|
||||
jobs:
|
||||
git-mirror:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
steps:
|
||||
- name: git-sync
|
||||
uses: AMD-ROCm-Internal/rocprofiler-github-actions@git-sync-v3
|
||||
with:
|
||||
source_repo: "https://${{ secrets.TOKEN }}@github.com/AMD-ROCm-Internal/rocprofiler-sdk-internal.git"
|
||||
source_branch: "amd-mainline"
|
||||
destination_repo: "https://${{ secrets.EXT_TOKEN }}@github.com/ROCm/rocprofiler-sdk.git"
|
||||
destination_branch: "amd-mainline"
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Sync amd-staging to public repository
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ amd-staging ]
|
||||
|
||||
jobs:
|
||||
git-mirror:
|
||||
runs-on: AMD-ROCm-Internal-dev1
|
||||
steps:
|
||||
- name: git-sync
|
||||
uses: AMD-ROCm-Internal/rocprofiler-github-actions@git-sync-v3
|
||||
with:
|
||||
source_repo: "https://${{ secrets.TOKEN }}@github.com/AMD-ROCm-Internal/rocprofiler-sdk-internal.git"
|
||||
source_branch: "amd-staging"
|
||||
destination_repo: "https://${{ secrets.EXT_TOKEN }}@github.com/ROCm/rocprofiler-sdk.git"
|
||||
destination_branch: "amd-staging"
|
||||
@@ -0,0 +1,44 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# Build directories
|
||||
/compile_commands.json
|
||||
/build*
|
||||
/.cache
|
||||
*.vscode
|
||||
|
||||
# Github Workflows
|
||||
/.github
|
||||
|
||||
# VSCode Workspaces
|
||||
*.code-workspace
|
||||
@@ -0,0 +1,42 @@
|
||||
[submodule "external/googletest"]
|
||||
path = external/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
[submodule "external/glog"]
|
||||
path = external/glog
|
||||
url = https://github.com/google/glog.git
|
||||
[submodule "fmt"]
|
||||
path = external/fmt
|
||||
url = https://github.com/fmtlib/fmt.git
|
||||
[submodule "source/docs/doxygen-awesome-css"]
|
||||
path = external/doxygen-awesome-css
|
||||
url = https://github.com/jothepro/doxygen-awesome-css.git
|
||||
[submodule "external/ptl"]
|
||||
path = external/ptl
|
||||
url = https://github.com/jrmadsen/PTL
|
||||
[submodule "external/cereal"]
|
||||
path = external/cereal
|
||||
url = https://github.com/jrmadsen/cereal.git
|
||||
[submodule "external/filesystem"]
|
||||
path = external/filesystem
|
||||
url = https://github.com/gulrak/filesystem.git
|
||||
[submodule "external/perfetto"]
|
||||
path = external/perfetto
|
||||
url = https://github.com/google/perfetto
|
||||
[submodule "external/elfio"]
|
||||
path = external/elfio
|
||||
url = https://github.com/serge1/ELFIO.git
|
||||
[submodule "external/yaml-cpp"]
|
||||
path = external/yaml-cpp
|
||||
url = https://github.com/jbeder/yaml-cpp.git
|
||||
[submodule "external/json"]
|
||||
path = external/json
|
||||
url = https://github.com/nlohmann/json.git
|
||||
[submodule "external/sqlite"]
|
||||
path = external/sqlite
|
||||
url = https://github.com/sqlite/sqlite
|
||||
[submodule "external/pybind11"]
|
||||
path = external/pybind11
|
||||
url = https://github.com/pybind/pybind11.git
|
||||
[submodule "external/gotcha"]
|
||||
path = external/gotcha
|
||||
url = https://jrmadsen@github.com/jrmadsen/GOTCHA
|
||||
@@ -0,0 +1,24 @@
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
version: 2
|
||||
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "mambaforge-22.9"
|
||||
jobs:
|
||||
post_create_environment:
|
||||
- ./source/scripts/update-doxygen.sh
|
||||
|
||||
conda:
|
||||
environment: source/docs/environment.yml
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: source/docs/sphinx/requirements.txt
|
||||
|
||||
sphinx:
|
||||
configuration: source/docs/conf.py
|
||||
|
||||
formats: [htmlzip, pdf, epub]
|
||||
@@ -0,0 +1,222 @@
|
||||
# Changelog for ROCprofiler-SDK
|
||||
|
||||
Full documentation for ROCprofiler-SDK is available at [rocm.docs.amd.com/projects/rocprofiler-sdk](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/index.html)
|
||||
|
||||
## ROCprofiler-SDK for AFAR I
|
||||
|
||||
### Added
|
||||
|
||||
- HSA API tracing
|
||||
- Kernel dispatch tracing
|
||||
- Kernel dispatch counter collection
|
||||
- Instances reported as single dimension
|
||||
- No serialization
|
||||
|
||||
## ROCprofiler-SDK for AFAR II
|
||||
|
||||
### Added
|
||||
|
||||
- HIP API tracing
|
||||
- ROCTx tracing
|
||||
- Tracing ROCProf Tool V3
|
||||
- Documentation packaging
|
||||
- ROCTx control (start and stop)
|
||||
- Memory copy tracing
|
||||
|
||||
## ROCprofiler-SDK for AFAR III
|
||||
|
||||
### Added
|
||||
|
||||
- Kernel dispatch counter collection. This includes serialization and multidimensional instances.
|
||||
- Kernel serialization.
|
||||
- Serialization control (on and off).
|
||||
- ROCprof tool plugin interface V3 for counters and dimensions.
|
||||
- Support to list metrics.
|
||||
- Correlation-Id retirement
|
||||
- HIP and HSA trace distinction:
|
||||
- --hip-runtime-trace For collecting HIP Runtime API traces
|
||||
- --hip-compiler-trace For collecting HIP compiler-generated code traces
|
||||
- --hsa-core-trace For collecting HSA API traces (core API)
|
||||
- --hsa-amd-trace For collecting HSA API traces (AMD-extension API)
|
||||
- --hsa-image-trace For collecting HSA API traces (image-extension API)
|
||||
- --hsa-finalizer-trace For collecting HSA API traces (finalizer-extension API)
|
||||
|
||||
## ROCprofiler-SDK for AFAR IV
|
||||
|
||||
### Added
|
||||
|
||||
**API:**
|
||||
|
||||
- Page migration reporting
|
||||
- Scratch memory reporting
|
||||
- Kernel dispatch callback tracing
|
||||
- External correlation Id request service
|
||||
- Buffered counter collection record headers
|
||||
- Option to remove HSA dependency from counter collection
|
||||
|
||||
**Tool:**
|
||||
|
||||
- `rocprofv3` multi-GPU support in a single-process
|
||||
|
||||
## ROCprofiler-SDK for AFAR V
|
||||
|
||||
### Added
|
||||
|
||||
**API:**
|
||||
|
||||
- Agent or device counter collection
|
||||
- PC sampling (beta)
|
||||
|
||||
**Tool:**
|
||||
|
||||
- Single JSON output format support
|
||||
- Perfetto output format support (.pftrace)
|
||||
- Input YAML support for counter collection
|
||||
- Input JSON support for counter collection
|
||||
- Application replay in counter collection
|
||||
- `rocprofv3` multi-GPU support:
|
||||
- Multiprocess (multiple files)
|
||||
|
||||
### Changed
|
||||
|
||||
- `rocprofv3` tool now requires mentioning `--` before the application. For detailed use, see [Using rocprofv3](source/docs/how-to/using-rocprofv3.rst)
|
||||
|
||||
### Resolved issues
|
||||
|
||||
- Fixed `SQ_ACCUM_PREV` and `SQ_ACCUM_PREV_HIRE` overwriting issue
|
||||
|
||||
## ROCprofiler-SDK 0.4.0 for ROCm release 6.2 (AFAR VI)
|
||||
|
||||
### Added
|
||||
|
||||
- OTF2 tool support
|
||||
- Kernel and range filtering
|
||||
- Counter collection definitions in YAML
|
||||
- Documentation updates (SQ block, counter collection, tracing, tool usage)
|
||||
- `rocprofv3` option `--kernel-rename`
|
||||
- `rocprofv3` options for Perfetto settings (buffer size and so on)
|
||||
- CSV columns for kernel trace
|
||||
- `Thread_Id`
|
||||
- `Dispatch_Id`
|
||||
- CSV column for counter collection
|
||||
|
||||
## ROCprofiler-SDK 0.5.0 for ROCm release 6.3 (AFAR VII)
|
||||
|
||||
### Added
|
||||
|
||||
- Start and end timestamp columns to the counter collection csv output
|
||||
- Check to force tools to initialize context id with zero
|
||||
- Support to specify hardware counters for collection using rocprofv3 as `rocprofv3 --pmc [COUNTER [COUNTER ...]]`
|
||||
- Memory Allocation Tracing
|
||||
- PC sampling tool support with CSV and JSON output formats
|
||||
- List supported PC Sampling Configurations
|
||||
|
||||
### Changed
|
||||
|
||||
- `--marker-trace` option for `rocprofv3` now supports the legacy ROCTx library `libroctx64.so` when the application is linked against the new library `librocprofiler-sdk-roctx.so`.
|
||||
- Replaced deprecated `hipHostMalloc` and `hipHostFree` functions with `hipExtHostAlloc` and `hipFreeHost` for ROCm versions starting 6.3.
|
||||
- Updated `rocprofv3` `--help` options.
|
||||
- Changed naming of "agent profiling" to a more descriptive "device counting service". To convert existing tool or user code to the new name, use the following sed:
|
||||
`find . -type f -exec sed -i 's/rocprofiler_agent_profile_callback_t/rocprofiler_device_counting_service_callback_t/g; s/rocprofiler_configure_agent_profile_counting_service/rocprofiler_configure_device_counting_service/g; s/agent_profile.h/device_counting_service.h/g; s/rocprofiler_sample_agent_profile_counting_service/rocprofiler_sample_device_counting_service/g' {} +`
|
||||
- Changed naming of "dispatch profiling service" to a more descriptive "dispatch counting service". To convert existing tool or user code to the new names, the following sed can be used: `-type f -exec sed -i -e 's/dispatch_profile_counting_service/dispatch_counting_service/g' -e 's/dispatch_profile.h/dispatch_counting_service.h/g' -e 's/rocprofiler_profile_counting_dispatch_callback_t/rocprofiler_dispatch_counting_service_callback_t/g' -e 's/rocprofiler_profile_counting_dispatch_data_t/rocprofiler_dispatch_counting_service_data_t/g' -e 's/rocprofiler_profile_counting_dispatch_record_t/rocprofiler_dispatch_counting_service_record_t/g' {} +`
|
||||
- `FETCH_SIZE` metric on gfx94x now uses `TCC_BUBBLE` for 128B reads.
|
||||
- PMC dispatch-based counter collection serialization is now per-device instead of being global across all devices.
|
||||
- Added output return functionality to rocprofiler_sample_device_counting_service
|
||||
- Added rocprofiler_load_counter_definition.
|
||||
|
||||
### Resolved issues
|
||||
|
||||
- Create subdirectory when `rocprofv3 --output-file` includes a folder path
|
||||
- Fixed misaligned stores (undefined behavior) for buffer records
|
||||
- Fixed crash when only scratch reporting is enabled
|
||||
- Fixed `MeanOccupancy` metrics
|
||||
- Fixed aborted-application validation test to properly check for `hipExtHostAlloc` command
|
||||
- Fixed implicit reduction of SQ and GRBM metrics
|
||||
- Fixed support for derived counters in reduce operation
|
||||
- Bug fixed in max-in-reduce operation
|
||||
- Introduced fix to handle a range of values for `select()` dimension in expressions parser
|
||||
- Conditional `aql::set_profiler_active_on_queue` only when counter collection is registered (resolves Navi3 kernel tracing issues)
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed gfx8 metric definitions
|
||||
- Removed `rocprofv3` installation to sbin directory
|
||||
|
||||
## ROCprofiler-SDK 0.6.0 for ROCm release 6.4
|
||||
|
||||
### Added
|
||||
|
||||
- Support for `select()` operation in counter expression.
|
||||
- `reduce()` operation for counter expression with respect to dimension.
|
||||
- `--collection-period` feature in `rocprofv3` to enable filtering using time.
|
||||
- `--collection-period-unit` feature in `rocprofv3` to control time units used in collection period option.
|
||||
- Deprecation notice for ROCProfiler and ROCProfilerV2.
|
||||
- Support for rocDecode API Tracing
|
||||
- Usage documentation for ROCTx
|
||||
- Usage documentation for MPI applications
|
||||
- SDK: `rocprofiler_agent_v0_t` support for agent UUIDs
|
||||
- SDK: `rocprofiler_agent_v0_t` support for agent visibility based on gpu isolation environment variables such as `ROCR_VISIBLE_DEVICES` and so on.
|
||||
- Accumulation VGPR support for `rocprofv3`.
|
||||
- Host-trap based PC sampling support for rocprofv3.
|
||||
- Support for OpenMP tool.
|
||||
|
||||
## ROCprofiler-SDK 1.0.0 for ROCm release 7.0
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for rocJPEG API Tracing
|
||||
- Added MI350X/MI355X support
|
||||
- Added rocprofiler_create_counter to allow for adding custom derived counters at runtime.
|
||||
- Added support for iteration based counter multiplexing to rocprofv3 (see documentation)
|
||||
- Added perfetto support for counter collection.
|
||||
- Added support for negating rocprofv3 tracing options when using aggregate options, e.g. `--sys-trace --hsa-trace=no`
|
||||
- Added `--agent-index` option in rocprofv3 to specify the agent naming convention in the output
|
||||
- absolute == node_id
|
||||
- relative == logical_node_id
|
||||
- type-relative == logical_node_type_id
|
||||
- Added MI300/MI350 stochastic (hardware-based) PC sampling support in ROCProfiler-SDK and ROCProfV3
|
||||
- Python bindings for rocprofiler-sdk-roctx
|
||||
- SQLite3 output support for rocprofv3 (`--output-format rocpd`)
|
||||
- Added `rocprofiler-sdk-rocpd` package
|
||||
- public API in `include/rocprofiler-sdk-rocpd/rocpd.h`
|
||||
- library implementation in `librocprofiler-sdk-rocpd.so`
|
||||
- support for `find_package(rocprofiler-sdk-rocpd)`
|
||||
- `rocprofiler-sdk-rocpd` DEB and RPM packages
|
||||
- Support `--version` option for `rocprofv3`
|
||||
- Added `rocpd` Python package
|
||||
- Added thread trace as experimental API
|
||||
- Added ROCprof Trace Decoder as experimental API
|
||||
- Requires [ROCprof Trace Decoder plugin](https://github.com/rocm/rocprof-trace-decoder)
|
||||
- Added thread trace option to the rocprofv3 tool under the --att parameters
|
||||
- See [using thread trace with rocprofv3](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/amd-mainline/how-to/using-thread-trace.html)
|
||||
- Requires the ROCprof Trace Decoder plugin installed (see above).
|
||||
- Added `rocpd` output format documentation
|
||||
- Requires the ROCprof Trace Decoder plugin installed (see above)
|
||||
- Added perfetto support for scratch memory.
|
||||
|
||||
### Changed
|
||||
|
||||
- SDK no longer creates a background thread when every tool returns a nullptr from `rocprofiler_configure`.
|
||||
- Updated disassembly.hpp's vaddr-to-file-offset mapping to use the dedicated comgr API.
|
||||
- rocprofiler_uuid_t ABI is changed to hold 128 bit value.
|
||||
- rocprofv3 shorthand argument for `--collection-period` is now `-P` (upper-case) as `-p` (lower-case) is reserved for later use
|
||||
- default output format for rocprofv3 is now `rocpd` (SQLite3 database)
|
||||
- rocprofv3 avail tool renamed from rocprofv3_avail to rocprofv3-avail tool
|
||||
- rocprofv3 avail tool has support for command line arguments.
|
||||
- rocprofv3 tool now allows for Thread Trace + PC Sampling on the same agent
|
||||
- fixed inconsistency for what is a "null" handle in `rocprofiler_*_id_t` structs.
|
||||
- correct answer is `.handle = 0` but some definitions used `UINT64_MAX`
|
||||
|
||||
### Resolved issues
|
||||
|
||||
- Fixed missing callbacks around internal thread creation within counter collection service
|
||||
- Fixed potential data race in rocprofiler-sdk double buffering scheme
|
||||
- Usage of std::regex in core rocprofiler-sdk library which causes segfaults/exceptions when used under dual ABI
|
||||
- Fixed perfetto counter collection by introducing per dispatch accumulation.
|
||||
- Code object disassembly was missing function inlining information
|
||||
- Fixed queue preemption error and HSA_STATUS_ERROR_INVALID_PACKET_FORMAT error for stochastic PC-sampling for MI300X, leading to more stable runs.
|
||||
- Fixed the system hang issue for host-trap PC-sampling on MI300X.
|
||||
|
||||
### Removed
|
||||
|
||||
- Support of gfx940 and gfx941 targets from compilation
|
||||
@@ -0,0 +1,137 @@
|
||||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQUAL
|
||||
CMAKE_SOURCE_DIR)
|
||||
set(MSG "")
|
||||
message(STATUS "Warning! Building from the source directory is not recommended")
|
||||
message(STATUS "If unintended, please remove 'CMakeCache.txt' and 'CMakeFiles'")
|
||||
message(STATUS "and build from a separate directory")
|
||||
message(AUTHOR_WARNING "In-source build")
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FULL_VERSION_STRING LIMIT_COUNT 1)
|
||||
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3"
|
||||
ROCPROFILER_SDK_VERSION "${FULL_VERSION_STRING}")
|
||||
|
||||
foreach(_LANG C CXX)
|
||||
set(CMAKE_${_LANG}_FLAGS_COVERAGE_INIT
|
||||
"-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage --coverage -DCODECOV=1"
|
||||
CACHE STRING "${_LANG} flags for code coverage builds")
|
||||
set(CMAKE_${_LANG}_FLAGS_COVERAGE
|
||||
"${CMAKE_${_LANG}_FLAGS_COVERAGE_INIT}"
|
||||
CACHE STRING "${_LANG} flags for code coverage builds")
|
||||
endforeach()
|
||||
|
||||
project(
|
||||
rocprofiler-sdk
|
||||
LANGUAGES C CXX
|
||||
VERSION ${ROCPROFILER_SDK_VERSION}
|
||||
DESCRIPTION "ROCm GPU performance analysis SDK"
|
||||
HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-sdk")
|
||||
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core")
|
||||
set(PACKAGE_NAME ${PROJECT_NAME})
|
||||
|
||||
if(NOT PROJECT_IS_TOP_LEVEL)
|
||||
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
|
||||
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags
|
||||
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
||||
ERROR_QUIET)
|
||||
|
||||
if(NOT _GIT_DESCRIBE_RESULT EQUAL 0)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe
|
||||
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
||||
ERROR_QUIET)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
else()
|
||||
set(ROCPROFILER_SDK_GIT_DESCRIBE "v${ROCPROFILER_SDK_VERSION}")
|
||||
set(ROCPROFILER_SDK_GIT_REVISION "")
|
||||
endif()
|
||||
|
||||
# make sure that cmake re-runs when version file changes
|
||||
configure_file(${PROJECT_SOURCE_DIR}/VERSION ${PROJECT_BINARY_DIR}/VERSION COPYONLY)
|
||||
|
||||
message(
|
||||
STATUS
|
||||
"[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})"
|
||||
)
|
||||
message(STATUS "[${PROJECT_NAME}] git revision: ${ROCPROFILER_SDK_GIT_REVISION}")
|
||||
message(STATUS "[${PROJECT_NAME}] git describe: ${ROCPROFILER_SDK_GIT_DESCRIBE}")
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake/Modules
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
include(GNUInstallDirs) # install directories
|
||||
set(CMAKE_INSTALL_LIBDIR "lib") # rocm doesn't use lib64
|
||||
set(CMAKE_BUILD_RPATH "${PROJECT_BINARY_DIR}/lib:\$ORIGIN:\$ORIGIN/../lib")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH
|
||||
OFF
|
||||
CACHE BOOL "")
|
||||
set(CMAKE_DEBUG_POSTFIX
|
||||
""
|
||||
CACHE STRING "Suffix for non-executable build targets")
|
||||
mark_as_advanced(CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_DEBUG_POSTFIX)
|
||||
|
||||
set(ROCPROFILER_INTERNAL_BUILD_DOCS
|
||||
OFF
|
||||
CACHE INTERNAL "Generates rocprofiler-sdk/version.h and exits (no build targets)")
|
||||
if(ROCPROFILER_INTERNAL_BUILD_DOCS)
|
||||
add_subdirectory(source/include)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(rocprofiler_utilities) # various functions/macros
|
||||
include(rocprofiler_interfaces) # interface libraries
|
||||
include(rocprofiler_compilers) # compiler identification
|
||||
include(rocprofiler_options) # project options
|
||||
include(rocprofiler_build_settings) # build flags
|
||||
include(rocprofiler_formatting) # formatting
|
||||
include(rocprofiler_linting) # clang-tidy
|
||||
include(rocprofiler_config_interfaces) # configure interface libraries
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
|
||||
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
add_subdirectory(external)
|
||||
add_subdirectory(source)
|
||||
|
||||
include(rocprofiler_config_install)
|
||||
include(rocprofiler_config_install_roctx)
|
||||
include(rocprofiler_config_install_rocpd)
|
||||
|
||||
if(ROCPROFILER_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_BENCHMARK)
|
||||
add_subdirectory(benchmark)
|
||||
endif()
|
||||
|
||||
include(rocprofiler_config_packaging)
|
||||
|
||||
rocprofiler_print_features()
|
||||
@@ -0,0 +1,25 @@
|
||||
# Default code owners for the rocprofiler-sdk-internal
|
||||
#
|
||||
* @jrmadsen @t-tye
|
||||
|
||||
# Section-specific code owners
|
||||
#
|
||||
source/docs @bgopesh
|
||||
|
||||
source/include @jrmadsen @bwelton @ammarwa
|
||||
source/include/rocprofiler-sdk/rccl @MythreyaK
|
||||
source/include/rocprofiler-sdk/kfd @MythreyaK
|
||||
source/include/rocprofiler-sdk/cxx/codeobj @ApoKalipse-V
|
||||
source/bin @SrirakshaNag @bgopesh
|
||||
|
||||
source/libexec @SrirakshaNag
|
||||
|
||||
source/lib/rocprofiler-sdk/counters @bwelton
|
||||
source/lib/rocprofiler-sdk/pc_sampling @vlaindic
|
||||
source/lib/rocprofiler-sdk/thread_trace @ApoKalipse-V
|
||||
source/lib/rocprofiler-sdk/rccl @MythreyaK
|
||||
source/lib/rocprofiler-sdk/kfd @MythreyaK
|
||||
|
||||
source/lib/rocprofiler-sdk-tool @SrirakshaNag
|
||||
|
||||
source/lib/rocprofiler-sdk-codeobj @ApoKalipse-V
|
||||
@@ -0,0 +1,41 @@
|
||||
# Contributing to ROCProfiler SDK #
|
||||
|
||||
Contributions are welcome. Contributions at a basic level must conform to the MIT license and pass code test requirements (i.e. ctest). The author must also be able to respond to comments/questions on the PR and make any changes requested.
|
||||
|
||||
## Issue Discussion ##
|
||||
|
||||
Please use the GitHub Issues tab to let us know of any issues.
|
||||
|
||||
* Use your best judgment when creating issues. If your issue is already listed, please upvote the issue and
|
||||
comment or post to provide additional details, such as the way to reproduce this issue.
|
||||
* If you're unsure if your issue is the same, err on caution and file your issue.
|
||||
You can add a comment to include the issue number (and link) for a similar issue. If we evaluate
|
||||
your issue as being the same as the existing issue, we'll close the duplicate.
|
||||
* If your issue doesn't exist, use the issue template to file a new issue.
|
||||
* When you file an issue, please provide as much information as possible, including script output, so
|
||||
we can get information about your configuration. This helps reduce the time required to
|
||||
reproduce your issue.
|
||||
* Check your issue regularly, as we may require additional information to reproduce the
|
||||
issue successfully.
|
||||
* You may also open an issue to ask the maintainers whether a proposed change
|
||||
meets the acceptance criteria or to discuss an idea about the library.
|
||||
|
||||
## Acceptance Criteria ##
|
||||
|
||||
Github issues are recommended for any significant change to the code base that adds a feature or fixes a non-trivial issue. If the code change is large without the presence of an issue (or prior discussion with AMD), the change may not be reviewed. Small fixes that fix broken behavior or other bugs are always welcome with or without an associated issue.
|
||||
|
||||
## Coding Style ##
|
||||
|
||||
All changes must be formatted with clang-format-15/cmake-format before review/acceptance. The exact settings for these formatters must be the ones in this repository.
|
||||
|
||||
## Pull Request Guidelines ##
|
||||
|
||||
By creating a pull request, you agree to the statements made in the [code license](#code-license) section. Your pull request should target the default branch. Our current default branch is the **develop** branch, which serves as our integration branch.
|
||||
|
||||
## Code License ##
|
||||
|
||||
All code contributed to this project will be licensed under the license identified in the [License.txt](../LICENSE.txt). Your contribution will be accepted under the same license.
|
||||
|
||||
## Release Cadence ##
|
||||
|
||||
Any code contribution to this library will be released with the next version of ROCm if the contribution window for the upcoming release is still open. If the contribution window is closed but the PR contains a critical security/bug fix, an exception may be made to include the change in the next release.
|
||||
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: true
|
||||
@@ -0,0 +1,14 @@
|
||||
name: Documentation Fixes
|
||||
description: Documentation errors can be reported here.
|
||||
title: "[Documentation]: "
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Description of errors
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Attach any links, screenshots, or additional evidence you think will be helpful.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Feature Suggestion
|
||||
description: Suggest an additional functionality, or new way of handling an existing functionality.
|
||||
title: "[Feature]: "
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to make a suggestion!
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Suggestion Description
|
||||
description: Describe your suggestion.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: (Optional) If this is for a specific OS, you can mention it here.
|
||||
placeholder: "e.g. Ubuntu"
|
||||
- type: input
|
||||
attributes:
|
||||
label: GPU
|
||||
description: (Optional) If this is for a specific GPU or GPU family, you can mention it here.
|
||||
placeholder: "e.g. MI200"
|
||||
- type: input
|
||||
attributes:
|
||||
label: ROCm Component
|
||||
description: (Optional) If this issue relates to a specific ROCm component, it can be mentioned here.
|
||||
placeholder: "e.g. rocBLAS"
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
name: Issue Report
|
||||
description: File a report for ROCm related issues on Linux and Windows. For issues pertaining to documentation or non-bug related, please open a blank issue located below.
|
||||
title: "[Issue]: "
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to fill out this report!
|
||||
|
||||
You can acquire your OS, CPU, GPU (for filling out this report) with the following commands:
|
||||
|
||||
Linux:
|
||||
```
|
||||
echo "OS:" && cat /etc/os-release | grep -E "^(NAME=|VERSION=)";
|
||||
echo "CPU: " && cat /proc/cpuinfo | grep "model name" | sort --unique;
|
||||
echo "GPU:" && /opt/rocm/bin/rocminfo | grep -E "^\s*(Name|Marketing Name)";
|
||||
```
|
||||
|
||||
Windows:
|
||||
```
|
||||
(Get-WmiObject Win32_OperatingSystem).Version
|
||||
(Get-WmiObject win32_Processor).Name
|
||||
(Get-WmiObject win32_VideoController).Name
|
||||
```
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Problem Description
|
||||
description: Describe the issue you encountered.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: What is the name and version number of the OS?
|
||||
placeholder: "e.g. Ubuntu 22.04.3 LTS (Jammy Jellyfish)"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: CPU
|
||||
description: What CPU did you encounter the issue on?
|
||||
placeholder: "e.g. AMD Ryzen 9 5900HX with Radeon Graphics"
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: GPU
|
||||
description: What GPU(s) did you encounter the issue on (you can select multiple GPUs from the list)
|
||||
multiple: true
|
||||
options:
|
||||
- AMD Instinct MI300X
|
||||
- AMD Instinct MI300A
|
||||
- AMD Instinct MI250X
|
||||
- AMD Instinct MI250
|
||||
- AMD Instinct MI210
|
||||
- AMD Instinct MI100
|
||||
- AMD Radeon Pro W7900
|
||||
- AMD Radeon Pro W6800
|
||||
- AMD Radeon Pro V620
|
||||
- AMD Radeon Pro VII
|
||||
- AMD Radeon RX 7900 XTX
|
||||
- AMD Radeon RX 7900 XT
|
||||
- AMD Radeon VII
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: ROCm Version
|
||||
description: What version(s) of ROCm did you encounter the issue on?
|
||||
multiple: true
|
||||
options:
|
||||
- ROCm 6.0.0
|
||||
- ROCm 5.7.1
|
||||
- ROCm 5.7.0
|
||||
- ROCm 5.6.0
|
||||
- ROCm 5.5.1
|
||||
- ROCm 5.5.0
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: ROCm Component
|
||||
description: (Optional) If this issue relates to a specific ROCm component, it can be mentioned here.
|
||||
options:
|
||||
- AMDMIGraphX
|
||||
- amdsmi
|
||||
- aomp
|
||||
- aomp-extras
|
||||
- clang-ocl
|
||||
- clr
|
||||
- composable_kernel
|
||||
- flang
|
||||
- half
|
||||
- HIP
|
||||
- hipBLAS
|
||||
- HIPCC
|
||||
- hipCUB
|
||||
- HIP-Examples
|
||||
- hipFFT
|
||||
- hipfort
|
||||
- HIPIFY
|
||||
- hipSOLVER
|
||||
- hipSPARSE
|
||||
- hipTensor
|
||||
- llvm-project
|
||||
- MIOpen
|
||||
- MIVisionX
|
||||
- rccl
|
||||
- rdc
|
||||
- rocALUTION
|
||||
- rocBLAS
|
||||
- ROCdbgapi
|
||||
- rocFFT
|
||||
- ROCgdb
|
||||
- ROCK-Kernel-Driver
|
||||
- ROCm
|
||||
- rocm_bandwidth_test
|
||||
- rocm_smi_lib
|
||||
- rocm-cmake
|
||||
- ROCm-CompilerSupport
|
||||
- rocm-core
|
||||
- ROCm-Device-Libs
|
||||
- rocminfo
|
||||
- rocMLIR
|
||||
- ROCmValidationSuite
|
||||
- rocPRIM
|
||||
- rocprofiler
|
||||
- rocr_debug_agent
|
||||
- rocRAND
|
||||
- ROCR-Runtime
|
||||
- rocSOLVER
|
||||
- rocSPARSE
|
||||
- rocThrust
|
||||
- roctracer
|
||||
- ROCT-Thunk-Interface
|
||||
- rocWMMA
|
||||
- rpp
|
||||
- Tensile
|
||||
multiple: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: (Optional) Detailed steps to reproduce the issue.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: (Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
|
||||
description: The output of rocminfo --support could help to better address the problem.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: (Optional) Any additional information that is relevant, e.g. relevant environment variables, dockerfiles, log files, dmesg output (on Linux), etc.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,133 @@
|
||||
# ROCprofiler-SDK: Application Profiling, Tracing, and Performance Analysis
|
||||
|
||||
> [!IMPORTANT]
|
||||
We are phasing out development and support for `ROCTracer, ROCprofiler, rocprof, and rocprofv2` in favour of `ROCprofiler-SDK` and `rocprofv3` in upcoming ROCm releases. Starting with the `ROCm 6.4` release, only critical defect fixes will be addressed for older versions of the profiling tools and libraries. We encourage all users to upgrade to the latest version of the `ROCprofiler-SDK` library and the `rocprofv3` tool to ensure continued support and access to new features.
|
||||
|
||||
Please note that we anticipate the end of life for ROCprofiler V1/V2 and ROCTracer within nine months after the ROCm 7.0 release, aligning with the Q1 2026.
|
||||
|
||||
## Overview
|
||||
|
||||
ROCprofiler-SDK is AMD’s new and improved tooling infrastructure, providing a hardware-specific low-level performance analysis interface for profiling and tracing GPU compute applications. To see what's changed, [Click Here](source/docs/conceptual/comparing-with-legacy-tools.rst)
|
||||
|
||||
> [!NOTE]
|
||||
> The published documentation is available at [ROCprofiler-SDK documentation](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/index.html) in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the `rocprofiler-sdk/source/docs` folder of this repository. As with all ROCm projects, the documentation is open source. For more information on contributing to the documentation, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).
|
||||
|
||||
## GPU Metrics
|
||||
|
||||
- GPU hardware counters
|
||||
- Dispatch Counter Collection
|
||||
- Device Counter Collection
|
||||
- PC Sampling (Host Trap)
|
||||
- Thread trace and ROCprof trace decoder (SQTT, ATT).
|
||||
|
||||
## API Trace Support
|
||||
|
||||
- HIP API tracing
|
||||
- HSA API tracing
|
||||
- Marker (ROCTx) tracing
|
||||
- Memory copy tracing
|
||||
- Memory allocation tracing
|
||||
- Page Migration Event tracing
|
||||
- Scratch Memory tracing
|
||||
- RCCL API tracing
|
||||
- rocDecode API tracing
|
||||
- rocJPEG API tracing
|
||||
|
||||
## Parallelism API Support
|
||||
|
||||
- HIP
|
||||
- HSA
|
||||
- MPI
|
||||
- Kokkos-Tools (KokkosP)
|
||||
- OpenMP-Tools (OMPT)
|
||||
|
||||
## Tool Support
|
||||
|
||||
rocprofv3 is the command line tool built using the rocprofiler-sdk library and shipped with the ROCm stack. To see details on
|
||||
the command line options of rocprofv3, please see rocprofv3 user guide
|
||||
[Click Here](source/docs/how-to/using-rocprofv3.rst)
|
||||
|
||||
## Documentation
|
||||
|
||||
We make use of doxygen to generate API documentation automatically. The generated document can be found in the following path:
|
||||
|
||||
``` bash
|
||||
<ROCM_PATH>/share/html/rocprofiler-sdk
|
||||
```
|
||||
|
||||
ROCM_PATH by default is /opt/rocm
|
||||
It can be set by the user in different locations if needed.
|
||||
|
||||
## Build and Installation
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ROCm/rocprofiler-sdk.git rocprofiler-sdk-source
|
||||
cmake \
|
||||
-B rocprofiler-sdk-build \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rocm \
|
||||
-DCMAKE_PREFIX_PATH=/opt/rocm \
|
||||
rocprofiler-sdk-source
|
||||
|
||||
cmake --build rocprofiler-sdk-build --target all --parallel $(nproc)
|
||||
```
|
||||
|
||||
To install ROCprofiler, run:
|
||||
|
||||
```cmake --build rocprofiler-sdk-build --target install```
|
||||
|
||||
Please see the detailed section on build and installation here: [Click Here](source/docs/install/installation.rst)
|
||||
|
||||
## Support
|
||||
|
||||
Please report issues on GitHub OR send an email to <dl.ROCm-Profiler.support@amd.com>
|
||||
|
||||
## Limitations
|
||||
|
||||
- Individual XCC mode is not supported.
|
||||
|
||||
- By default, PC sampling API is disabled. To use PC sampling. Setting the `ROCPROFILER_PC_SAMPLING_BETA_ENABLED` environment variable grants access to the PC Sampling experimental beta feature. This feature is still under development and may not be completely stable.
|
||||
- **Risk Acknowledgment**: By activating this environment variable, you acknowledge and accept the following potential risks:
|
||||
- **Hardware Freeze**: This beta feature could cause your hardware to freeze unexpectedly.
|
||||
- **Need for Cold Restart**: In the event of a hardware freeze, you may need to perform a cold restart (turning the hardware off and on) to restore normal operations.
|
||||
Please use this beta feature cautiously. It may affect your system's stability and performance. Proceed at your own risk.
|
||||
|
||||
- At this point, we do not recommend stress-testing the beta implementation.
|
||||
|
||||
- Correlation IDs provided by the PC sampling service are verified only for HIP API calls.
|
||||
|
||||
- Timestamps in PC sampling records might not be 100% accurate.
|
||||
|
||||
- For low PC-sampling frequencies with intervals < 65k cycles, a lot of error samples might be delivered. We're working on optimizing this to allow lower sampling frequencies.
|
||||
|
||||
- gfx10, gfx11 and gfx12 requires a stable power state for counter collection. This includes Radeon 7000 GPUs.
|
||||
```bash
|
||||
# For device <N>. Use 'rocm-smi' or 'amd-smi monitor' to see device number.
|
||||
sudo amd-smi set -g <N> -l stable_std
|
||||
# After profiling, set power state back to 'auto'
|
||||
sudo amd-smi set -g <N> -l auto
|
||||
```
|
||||
|
||||
The gfx version can be found via `amd-smi static --asic -g <N>` in the `TARGET_GRAPHICS_VERSION` field:
|
||||
|
||||
```bash
|
||||
$ amd-smi static -a -g 2
|
||||
GPU: 2
|
||||
ASIC:
|
||||
MARKET_NAME: Navi 33 [Radeon Pro W7500]
|
||||
VENDOR_ID: 0x1002
|
||||
VENDOR_NAME: Advanced Micro Devices Inc. [AMD/ATI]
|
||||
SUBVENDOR_ID: 0x1002
|
||||
DEVICE_ID: 0x7489
|
||||
SUBSYSTEM_ID: 0x0e0d
|
||||
REV_ID: 0x00
|
||||
ASIC_SERIAL: N/A
|
||||
OAM_ID: N/A
|
||||
NUM_COMPUTE_UNITS: 28
|
||||
TARGET_GRAPHICS_VERSION: gfx1102
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
> [!WARNING]
|
||||
> The latest mainline version of AQLprofile can be found at [https://repo.radeon.com/rocm/misc/aqlprofile/](https://repo.radeon.com/rocm/misc/aqlprofile/). However, it's important to note that updates to the public AQLProfile may not occur as frequently as updates to the rocprofiler-sdk. This discrepancy could lead to a potential mismatch between the AQLprofile binary and the rocprofiler-sdk source.
|
||||
@@ -0,0 +1,5 @@
|
||||
# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build
|
||||
if [ "@ENABLE_LDCONFIG@" == "ON" ]; then
|
||||
echo @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ > /@CMAKE_INSTALL_SYSCONFDIR@/ld.so.conf.d/librocprofiler-sdk.conf
|
||||
ldconfig
|
||||
fi
|
||||
@@ -0,0 +1,4 @@
|
||||
# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build
|
||||
if [ "@ENABLE_LDCONFIG@" == "ON" ]; then
|
||||
rm -f /@CMAKE_INSTALL_SYSCONFDIR@/ld.so.conf.d/librocprofiler-sdk.conf && ldconfig
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
@@ -0,0 +1,10 @@
|
||||
# Exclude databases
|
||||
*.db
|
||||
*.db-journal
|
||||
/.rocprofv3/**
|
||||
|
||||
# Build directories
|
||||
/compile_commands.json
|
||||
/build*
|
||||
/.cache
|
||||
*.vscode
|
||||
@@ -0,0 +1,105 @@
|
||||
#
|
||||
# Integration tests
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
|
||||
|
||||
if(COMMAND rocprofiler_deactivate_clang_tidy)
|
||||
rocprofiler_deactivate_clang_tidy()
|
||||
endif()
|
||||
|
||||
project(rocprofiler-sdk-benchmark LANGUAGES C CXX)
|
||||
|
||||
#
|
||||
# project options
|
||||
#
|
||||
option(ROCPROFILER_BENCHMARK_INSTALL_TIMEM "Install timem" ON)
|
||||
|
||||
#
|
||||
# cmake overrides
|
||||
#
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "benchmark")
|
||||
set(ROCPROFILER_SDK_BENCHMARK_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set(ROCPROFILER_SDK_BENCHMARK_BINARY_DIR "${PROJECT_BINARY_DIR}")
|
||||
|
||||
if(NOT PROJECT_IS_TOP_LEVEL)
|
||||
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
"Release"
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_HIP_STANDARD 17)
|
||||
set(CMAKE_HIP_EXTENSIONS OFF)
|
||||
set(CMAKE_HIP_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
# always use lib instead of lib64
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
set(CMAKE_INSTALL_LIB64DIR "lib64")
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CMAKE_DATAROOT_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}")
|
||||
|
||||
# define the library output directory
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../VERSION" FULL_VERSION_STRING LIMIT_COUNT 1)
|
||||
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3"
|
||||
ROCPROFILER_SDK_VERSION "${FULL_VERSION_STRING}")
|
||||
|
||||
find_package(Git)
|
||||
|
||||
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/../.git")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/..
|
||||
OUTPUT_VARIABLE ROCPROFILER_SDK_GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
else()
|
||||
set(ROCPROFILER_SDK_GIT_REVISION "")
|
||||
endif()
|
||||
else()
|
||||
set(ROCPROFILER_BENCHMARK_INSTALL_PREFIX
|
||||
${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-sdk/benchmark
|
||||
CACHE PATH "relative install prefix for rocprofiler-sdk benchmark")
|
||||
set(_GNUInstallDirs_VARIABLES
|
||||
BINDIR
|
||||
SBINDIR
|
||||
LIBEXECDIR
|
||||
SYSCONFDIR
|
||||
SHAREDSTATEDIR
|
||||
LOCALSTATEDIR
|
||||
RUNSTATEDIR
|
||||
LIBDIR
|
||||
LIB64DIR # locally defined
|
||||
INCLUDEDIR
|
||||
OLDINCLUDEDIR
|
||||
DATAROOTDIR
|
||||
DATADIR
|
||||
INFODIR
|
||||
LOCALEDIR
|
||||
MANDIR
|
||||
DOCDIR)
|
||||
|
||||
foreach(_INSTALL_DIR ${_GNUInstallDirs_VARIABLES})
|
||||
set(CMAKE_INSTALL_${_INSTALL_DIR}
|
||||
${ROCPROFILER_BENCHMARK_INSTALL_PREFIX}/${CMAKE_INSTALL_${_INSTALL_DIR}})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# include the timem executable
|
||||
include(timem)
|
||||
|
||||
add_subdirectory(source)
|
||||
@@ -0,0 +1,21 @@
|
||||
# Benchmark Suite
|
||||
|
||||
## Generate Data
|
||||
|
||||
From the current directory:
|
||||
|
||||
```shell
|
||||
cmake -B build-benchmark .
|
||||
cd build-benchmark
|
||||
export PATH=${PWD}/bin:${PATH}
|
||||
rocprofv3-benchmark -i ./example.yml -n 2
|
||||
```
|
||||
|
||||
```shell
|
||||
sqlite3 benchmark.db
|
||||
```
|
||||
|
||||
```sql
|
||||
SELECT * FROM benchmark_metrics;
|
||||
SELECT * FROM benchmark_statistics;
|
||||
```
|
||||
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# timem installation
|
||||
#
|
||||
|
||||
if(NOT ROCPROFILER_BENCHMARK_INSTALL_TIMEM)
|
||||
find_program(
|
||||
TIMEM_EXECUTABLE
|
||||
NAMES timem
|
||||
HINTS ${PROJECT_BINARY_DIR}
|
||||
PATHS ${PROJECT_BINARY_DIR}
|
||||
PATH_SUFFIXES bin)
|
||||
endif()
|
||||
|
||||
if(NOT TIMEM_EXECUTABLE OR NOT EXISTS "${TIMEM_EXECUTABLE}")
|
||||
set(TIMEM_INSTALLER
|
||||
${CMAKE_CURRENT_BINARY_DIR}/installer/timemory-timem-1.0.0-Linux.sh)
|
||||
find_program(SHELL_EXECUTABLE NAMES sh bash REQUIRED)
|
||||
|
||||
file(
|
||||
DOWNLOAD
|
||||
https://github.com/ROCm/timemory/releases/download/timemory-timem%2Fv0.0.4/timemory-timem-1.0.0-Linux.sh
|
||||
${TIMEM_INSTALLER}
|
||||
EXPECTED_MD5 63da7df7996a86d6d9ce312276c2f014
|
||||
INACTIVITY_TIMEOUT 30
|
||||
TIMEOUT 300
|
||||
SHOW_PROGRESS)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${SHELL_EXECUTABLE} ${TIMEM_INSTALLER} --prefix=${PROJECT_BINARY_DIR}
|
||||
--exclude-subdir --skip-license
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
RESULT_VARIABLE _RET
|
||||
OUTPUT_VARIABLE _OUT
|
||||
ERROR_VARIABLE _ERR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/bin/timem OR NOT _RET EQUAL 0)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"timem installation failed with exit code ${_RET}.\nSTDOUT:\n\t${_OUT}\nSTDERR:\n\t${_ERR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(
|
||||
TIMEM_EXECUTABLE
|
||||
NAMES timem REQUIRED
|
||||
HINTS ${PROJECT_BINARY_DIR}
|
||||
PATHS ${PROJECT_BINARY_DIR}
|
||||
PATH_SUFFIXES bin)
|
||||
|
||||
add_executable(rocprofiler-sdk::timem IMPORTED)
|
||||
set_property(TARGET rocprofiler-sdk::timem PROPERTY IMPORTED_LOCATION ${TIMEM_EXECUTABLE})
|
||||
@@ -0,0 +1,50 @@
|
||||
defaults:
|
||||
rocprofv3:
|
||||
# keys such as "runtime", "kernel", etc. below can be used with --filter-rocprofv3 option
|
||||
runtime: [--runtime-trace]
|
||||
sys: [--sys-trace]
|
||||
kernel: [--kernel-trace]
|
||||
hip: [--hip-trace]
|
||||
hsa: [--hsa-trace]
|
||||
memcpy: [--memory-copy-trace]
|
||||
malloc: [--memory-allocation-trace]
|
||||
scratch: [--scratch-memory-trace]
|
||||
counters: [--pmc, SQ_WAVES]
|
||||
benchmark:
|
||||
- baseline
|
||||
- disabled-sdk-contexts
|
||||
- sdk-buffer-overhead
|
||||
- sdk-callback-overhead
|
||||
- tool-runtime-overhead
|
||||
group:
|
||||
- examples
|
||||
environment:
|
||||
ROCR_VISIBLE_DEVICES: "0,2"
|
||||
HIP_VISIBLE_DEVICES: "0,2"
|
||||
|
||||
jobs:
|
||||
# explicitly specifies name, group, and command. inherits default rocprofv3 commands and benchmark modes
|
||||
- name: hip-in-libraries
|
||||
group: [examples, multigpu, multistream]
|
||||
command: [hip-in-libraries]
|
||||
|
||||
# explicitly specifies name, group, command, and rocprofv3. inherits default benchmark modes
|
||||
- name: transpose
|
||||
group: [examples, multithreaded, multigpu, multistream]
|
||||
command: [transpose, 4, 500, 10]
|
||||
launcher: [mpirun, -n, 1]
|
||||
rocprofv3:
|
||||
- [-r, --pmc, SQ_WAVES]
|
||||
- [--kernel-trace]
|
||||
- [--hip-trace]
|
||||
|
||||
# explicitly specifies name, command, rocprofv3, and benchmark. inherits default group(s)
|
||||
- name: hip-graph
|
||||
command: [hip-graph, 8, 500]
|
||||
rocprofv3:
|
||||
- [--kernel-trace]
|
||||
- [--hip-trace]
|
||||
- [--hsa-trace]
|
||||
benchmark:
|
||||
- baseline
|
||||
- disabled-sdk-contexts
|
||||
@@ -0,0 +1,32 @@
|
||||
defaults:
|
||||
rocprofv3:
|
||||
# keys are not provided so --filter-rocprofv3 option isn't supported for this YAML input
|
||||
- [--runtime-trace]
|
||||
- [--sys-trace]
|
||||
- [--kernel-trace]
|
||||
- [--hip-trace]
|
||||
- [--hsa-trace]
|
||||
- [--memory-copy-trace]
|
||||
- [--memory-allocation-trace]
|
||||
- [--scratch-memory-trace]
|
||||
- [--pmc, SQ_WAVES]
|
||||
benchmark:
|
||||
# these names can be used with --filter-benchmark option
|
||||
- baseline
|
||||
- disabled-sdk-contexts
|
||||
- sdk-buffer-overhead
|
||||
- sdk-callback-overhead
|
||||
- tool-runtime-overhead
|
||||
group:
|
||||
- examples
|
||||
|
||||
jobs:
|
||||
# explicitly specifies name, command, rocprofv3, and benchmark. inherits default group(s)
|
||||
- name: hip-graph
|
||||
command: [hip-graph, 8, 500]
|
||||
rocprofv3:
|
||||
- [--kernel-trace]
|
||||
- [--hip-trace]
|
||||
benchmark:
|
||||
- baseline
|
||||
- disabled-sdk-contexts
|
||||
@@ -0,0 +1,3 @@
|
||||
# these are optional, not required
|
||||
mysql-connector-python
|
||||
pyelftools
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(bin)
|
||||
add_subdirectory(share)
|
||||
@@ -0,0 +1,24 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
# Adding main rocprofv3
|
||||
configure_file(rocprofv3-benchmark.py
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rocprofv3-benchmark @ONLY)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rocprofv3-benchmark
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
|
||||
WORLD_EXECUTE)
|
||||
|
||||
# downloaded timem
|
||||
install(
|
||||
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/timem
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
|
||||
WORLD_EXECUTE
|
||||
OPTIONAL)
|
||||
|
||||
# Adding Benchmark Workloads
|
||||
add_subdirectory(mandelbrot)
|
||||
@@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
|
||||
|
||||
if(NOT CMAKE_HIP_COMPILER)
|
||||
find_program(
|
||||
amdclangpp_EXECUTABLE
|
||||
NAMES amdclang++
|
||||
HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
|
||||
PATHS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
|
||||
PATH_SUFFIXES bin llvm/bin NO_CACHE)
|
||||
mark_as_advanced(amdclangpp_EXECUTABLE)
|
||||
|
||||
if(amdclangpp_EXECUTABLE)
|
||||
set(CMAKE_HIP_COMPILER "${amdclangpp_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
project(rocprofiler-sdk-benchmark-bin-mandelbrot LANGUAGES CXX HIP)
|
||||
|
||||
foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
|
||||
if("${CMAKE_HIP_FLAGS_${_TYPE}}" STREQUAL "")
|
||||
set(CMAKE_HIP_FLAGS_${_TYPE} "${CMAKE_CXX_FLAGS_${_TYPE}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_HIP_STANDARD 17)
|
||||
set(CMAKE_HIP_EXTENSIONS OFF)
|
||||
set(CMAKE_HIP_STANDARD_REQUIRED ON)
|
||||
|
||||
set_source_files_properties(mandelbrot.cpp PROPERTIES LANGUAGE HIP)
|
||||
set_source_files_properties(utils.cpp PROPERTIES LANGUAGE HIP)
|
||||
|
||||
add_executable(mandelbrot)
|
||||
target_sources(mandelbrot PRIVATE mandelbrot.cpp utils.cpp)
|
||||
target_compile_options(mandelbrot PRIVATE -W -Wall -Wextra -Wpedantic -Werror
|
||||
-ffp-contract=fast)
|
||||
target_include_directories(mandelbrot PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
install(
|
||||
TARGETS mandelbrot
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT benchmark)
|
||||
@@ -0,0 +1,938 @@
|
||||
/*
|
||||
Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* HIT_START
|
||||
* BUILD: %t %s ../../src/test_common.cpp
|
||||
* TEST: %t
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
#include <hip/hip_vector_types.h>
|
||||
#include <hip/math_functions.h>
|
||||
#include <omp.h>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double width;
|
||||
} coordRec;
|
||||
|
||||
coordRec coords[] = {
|
||||
{0.0, 0.0, 4.0}, // Whole set
|
||||
{0.0, 0.0, 0.00001}, // All black
|
||||
{-0.0180789661868, 0.6424294066162, 0.00003824140}, // Hit detail
|
||||
};
|
||||
|
||||
static unsigned int numCoords = sizeof(coords) / sizeof(coordRec);
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
float_mad_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep, uint maxIter)
|
||||
{
|
||||
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
int i = tid % width;
|
||||
int j = tid / width;
|
||||
float x0 = (float) (xPos + xStep * i);
|
||||
float y0 = (float) (yPos + yStep * j);
|
||||
|
||||
float x = x0;
|
||||
float y = y0;
|
||||
|
||||
uint iter = 0;
|
||||
float tmp;
|
||||
for(iter = 0; (x * x + y * y <= 4.0f) && (iter < maxIter); iter++)
|
||||
{
|
||||
tmp = x;
|
||||
x = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
}
|
||||
|
||||
out[tid] = iter;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
float_mandel_unroll_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep, uint maxIter)
|
||||
{
|
||||
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
int i = tid % width;
|
||||
int j = tid / width;
|
||||
float x0 = (float) (xPos + xStep * (float) i);
|
||||
float y0 = (float) (yPos + yStep * (float) j);
|
||||
|
||||
float x = x0;
|
||||
float y = y0;
|
||||
|
||||
#define FAST
|
||||
uint iter = 0;
|
||||
float tmp;
|
||||
int stay;
|
||||
uint ccount = 0;
|
||||
stay = (x * x + y * y) <= 4.0;
|
||||
float savx = x;
|
||||
float savy = y;
|
||||
#ifdef FAST
|
||||
for(iter = 0; (iter < maxIter); iter += 16)
|
||||
{
|
||||
#else
|
||||
for(iter = 0; stay && (iter < maxIter); iter += 16)
|
||||
{
|
||||
#endif
|
||||
x = savx;
|
||||
y = savy;
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
stay = (x * x + y * y) <= 4.0;
|
||||
savx = (stay ? x : savx);
|
||||
savy = (stay ? y : savy);
|
||||
ccount += stay * 16;
|
||||
#ifdef FAST
|
||||
if(!stay) break;
|
||||
#endif
|
||||
}
|
||||
// Handle remainder
|
||||
if(!stay)
|
||||
{
|
||||
iter = 16;
|
||||
do
|
||||
{
|
||||
x = savx;
|
||||
y = savy;
|
||||
stay = ((x * x + y * y) <= 4.0) && (ccount < maxIter);
|
||||
tmp = x;
|
||||
x = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
ccount += stay;
|
||||
iter--;
|
||||
savx = (stay ? x : savx);
|
||||
savy = (stay ? y : savy);
|
||||
} while(stay && iter);
|
||||
}
|
||||
|
||||
out[tid] = (uint) ccount;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
double_mad_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep, uint maxIter)
|
||||
{
|
||||
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
int i = tid % width;
|
||||
int j = tid / width;
|
||||
double x0 = (double) (xPos + xStep * i);
|
||||
double y0 = (double) (yPos + yStep * j);
|
||||
|
||||
double x = x0;
|
||||
double y = y0;
|
||||
|
||||
uint iter = 0;
|
||||
double tmp;
|
||||
for(iter = 0; (x * x + y * y <= 4.0f) && (iter < maxIter); iter++)
|
||||
{
|
||||
tmp = x;
|
||||
x = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
}
|
||||
out[tid] = iter;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
double_mandel_unroll_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep, uint maxIter)
|
||||
{
|
||||
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
|
||||
int i = tid % width;
|
||||
int j = tid / width;
|
||||
double x0 = (double) (xPos + xStep * (double) i);
|
||||
double y0 = (double) (yPos + yStep * (double) j);
|
||||
|
||||
double x = x0;
|
||||
double y = y0;
|
||||
|
||||
#define FAST
|
||||
uint iter = 0;
|
||||
double tmp;
|
||||
int stay;
|
||||
uint ccount = 0;
|
||||
stay = (x * x + y * y) <= 4.0;
|
||||
double savx = x;
|
||||
double savy = y;
|
||||
#ifdef FAST
|
||||
for(iter = 0; (iter < maxIter); iter += 16)
|
||||
#else
|
||||
for(iter = 0; stay && (iter < maxIter); iter += 16)
|
||||
#endif
|
||||
{
|
||||
x = savx;
|
||||
y = savy;
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
// Two iterations
|
||||
tmp = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * x, y, y0);
|
||||
x = fma(-y, y, fma(tmp, tmp, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
|
||||
stay = (x * x + y * y) <= 4.0;
|
||||
savx = (stay ? x : savx);
|
||||
savy = (stay ? y : savy);
|
||||
ccount += stay * 16;
|
||||
#ifdef FAST
|
||||
if(!stay) break;
|
||||
#endif
|
||||
}
|
||||
// Handle remainder
|
||||
if(!stay)
|
||||
{
|
||||
iter = 16;
|
||||
do
|
||||
{
|
||||
x = savx;
|
||||
y = savy;
|
||||
stay = ((x * x + y * y) <= 4.0) && (ccount < maxIter);
|
||||
tmp = x;
|
||||
x = fma(-y, y, fma(x, x, x0));
|
||||
y = fma(2.0f * tmp, y, y0);
|
||||
ccount += stay;
|
||||
iter--;
|
||||
savx = (stay ? x : savx);
|
||||
savy = (stay ? y : savy);
|
||||
} while(stay && iter);
|
||||
}
|
||||
out[tid] = (uint) ccount;
|
||||
};
|
||||
|
||||
// Commenting it out as it is not used anywhere in the code
|
||||
// static const unsigned int FMA_EXPECTEDVALUES_INDEX = 15;
|
||||
|
||||
// Expected results for each kernel run at each coord
|
||||
unsigned long long expectedIters[] = {
|
||||
203277748ull, 2147483648ull, 120254651ull, 203277748ull, 2147483648ull, 120254651ull,
|
||||
203277748ull, 2147483648ull, 120254651ull, 203315114ull, 2147483648ull, 120042599ull,
|
||||
203315114ull, 2147483648ull, 120042599ull, 203280620ull, 2147483648ull, 120485704ull,
|
||||
203280620ull, 2147483648ull, 120485704ull, 203280620ull, 2147483648ull, 120485704ull,
|
||||
203315114ull, 2147483648ull, 120042599ull, 203315114ull, 2147483648ull, 120042599ull};
|
||||
|
||||
class hipPerfMandelBrot
|
||||
{
|
||||
public:
|
||||
hipPerfMandelBrot();
|
||||
~hipPerfMandelBrot();
|
||||
|
||||
void setNumKernels(unsigned int num) { numKernels = num; }
|
||||
|
||||
unsigned int getNumKernels() const { return numKernels; }
|
||||
|
||||
void setNumStreams(unsigned int num) { numStreams = num; }
|
||||
unsigned int getNumStreams() const { return numStreams; }
|
||||
|
||||
void open(int deviceID);
|
||||
void run(unsigned int testCase, unsigned int deviceId);
|
||||
void printResults(void);
|
||||
|
||||
// array of funtion pointers
|
||||
typedef void (hipPerfMandelBrot::*funPtr)(uint* out,
|
||||
uint width,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt);
|
||||
|
||||
// Wrappers
|
||||
void float_mad(uint* out,
|
||||
uint width,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt);
|
||||
|
||||
void float_mandel_unroll(uint* out,
|
||||
uint width,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt);
|
||||
|
||||
void double_mad(uint* out,
|
||||
uint width,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt);
|
||||
|
||||
void double_mandel_unroll(uint* out,
|
||||
uint width,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt);
|
||||
|
||||
hipStream_t streams[2];
|
||||
|
||||
private:
|
||||
void setData(void* ptr, unsigned int value);
|
||||
void checkData(uint* ptr);
|
||||
|
||||
unsigned int numKernels;
|
||||
unsigned int numStreams;
|
||||
|
||||
std::map<std::string, std::vector<double>> results;
|
||||
unsigned int width_;
|
||||
unsigned int bufSize;
|
||||
unsigned int maxIter;
|
||||
unsigned int coordIdx;
|
||||
volatile unsigned long long totalIters = 0;
|
||||
int numCUs;
|
||||
static const unsigned int numLoops = 10;
|
||||
};
|
||||
|
||||
hipPerfMandelBrot::hipPerfMandelBrot() = default;
|
||||
|
||||
hipPerfMandelBrot::~hipPerfMandelBrot() = default;
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::open(int deviceId)
|
||||
{
|
||||
int nGpu = 0;
|
||||
HIPCHECK(hipGetDeviceCount(&nGpu));
|
||||
if(nGpu < 1)
|
||||
{
|
||||
failed("No GPU!");
|
||||
}
|
||||
|
||||
HIPCHECK(hipSetDevice(deviceId));
|
||||
hipDeviceProp_t props = {};
|
||||
HIPCHECK(hipGetDeviceProperties(&props, deviceId));
|
||||
std::cout << "info: running on bus "
|
||||
<< "0x" << props.pciBusID << " " << props.name << " with "
|
||||
<< props.multiProcessorCount << " CUs"
|
||||
<< " and device id: " << deviceId << std::endl;
|
||||
|
||||
numCUs = props.multiProcessorCount;
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::printResults()
|
||||
{
|
||||
// int numkernels = getNumKernels();
|
||||
int numStreams = getNumStreams();
|
||||
|
||||
std::cout << "\n"
|
||||
<< "Measured perf for kernels in GFLOPS on " << numStreams << " streams (s)"
|
||||
<< std::endl;
|
||||
|
||||
std::map<std::string, std::vector<double>>::iterator itr;
|
||||
for(itr = results.begin(); itr != results.end(); itr++)
|
||||
{
|
||||
std::cout << "\n" << std::setw(20) << itr->first << " ";
|
||||
for(auto i : results[itr->first])
|
||||
{
|
||||
std::cout << std::setw(10) << i << " ";
|
||||
}
|
||||
}
|
||||
results.clear();
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Wrappers for the kernel launches
|
||||
void
|
||||
hipPerfMandelBrot::float_mad(uint* out,
|
||||
uint /* width */,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt)
|
||||
{
|
||||
int streamCnt = getNumStreams();
|
||||
hipLaunchKernelGGL(float_mad_kernel<float>,
|
||||
dim3(blocks),
|
||||
dim3(threads_per_block),
|
||||
0,
|
||||
streams[kernelCnt % streamCnt],
|
||||
out,
|
||||
width_,
|
||||
xPos,
|
||||
yPos,
|
||||
xStep,
|
||||
yStep,
|
||||
maxIter);
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::float_mandel_unroll(uint* out,
|
||||
uint /* width */,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt)
|
||||
{
|
||||
int streamCnt = getNumStreams();
|
||||
hipLaunchKernelGGL(float_mandel_unroll_kernel<float>,
|
||||
dim3(blocks),
|
||||
dim3(threads_per_block),
|
||||
0,
|
||||
streams[kernelCnt % streamCnt],
|
||||
out,
|
||||
width_,
|
||||
xPos,
|
||||
yPos,
|
||||
xStep,
|
||||
yStep,
|
||||
maxIter);
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::double_mad(uint* out,
|
||||
uint /* width */,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt)
|
||||
{
|
||||
int streamCnt = getNumStreams();
|
||||
hipLaunchKernelGGL(double_mad_kernel<double>,
|
||||
dim3(blocks),
|
||||
dim3(threads_per_block),
|
||||
0,
|
||||
streams[kernelCnt % streamCnt],
|
||||
out,
|
||||
width_,
|
||||
xPos,
|
||||
yPos,
|
||||
xStep,
|
||||
yStep,
|
||||
maxIter);
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::double_mandel_unroll(uint* out,
|
||||
uint /* width */,
|
||||
float xPos,
|
||||
float yPos,
|
||||
float xStep,
|
||||
float yStep,
|
||||
uint maxIter,
|
||||
hipStream_t* streams,
|
||||
int blocks,
|
||||
int threads_per_block,
|
||||
int kernelCnt)
|
||||
{
|
||||
int streamCnt = getNumStreams();
|
||||
hipLaunchKernelGGL(float_mandel_unroll_kernel<double>,
|
||||
dim3(blocks),
|
||||
dim3(threads_per_block),
|
||||
0,
|
||||
streams[kernelCnt % streamCnt],
|
||||
out,
|
||||
width_,
|
||||
xPos,
|
||||
yPos,
|
||||
xStep,
|
||||
yStep,
|
||||
maxIter);
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::run(unsigned int testCase, unsigned int /* deviceId */)
|
||||
{
|
||||
unsigned int numStreams = getNumStreams();
|
||||
coordIdx = testCase % numCoords;
|
||||
|
||||
funPtr p[] = {&hipPerfMandelBrot::float_mad,
|
||||
&hipPerfMandelBrot::float_mandel_unroll,
|
||||
&hipPerfMandelBrot::double_mad,
|
||||
&hipPerfMandelBrot::double_mandel_unroll};
|
||||
|
||||
// Maximum iteration count
|
||||
maxIter = 32768;
|
||||
|
||||
// Variable-length arrays (VLAs) are not part of the C++ standard, using std::vector instead
|
||||
// uint * hPtr[numKernels];
|
||||
// uint * dPtr[numKernels];
|
||||
std::vector<uint*> hPtr(numKernels);
|
||||
std::vector<uint*> dPtr(numKernels);
|
||||
|
||||
// Width is divisible by 4 because the mandelbrot kernel processes 4 pixels at once.
|
||||
width_ = 256;
|
||||
|
||||
bufSize = width_ * width_ * sizeof(uint);
|
||||
|
||||
// Create streams for concurrency
|
||||
for(uint i = 0; i < numStreams; i++)
|
||||
{
|
||||
HIPCHECK(hipStreamCreate(&streams[i]));
|
||||
}
|
||||
|
||||
// Allocate memory on the host and device
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
HIPCHECK(hipHostMalloc((void**) &hPtr[i], bufSize, hipHostMallocDefault));
|
||||
setData(hPtr[i], 0xdeadbeef);
|
||||
HIPCHECK(hipMalloc((uint**) &dPtr[i], bufSize))
|
||||
}
|
||||
|
||||
// Prepare kernel launch parameters
|
||||
int threads = (bufSize / sizeof(uint));
|
||||
int threads_per_block = 64;
|
||||
int blocks = (threads / threads_per_block) + (threads % threads_per_block);
|
||||
|
||||
// float xStep = (float)(coords[coordIdx].width / (double)width_);
|
||||
// float yStep = (float)(-coords[coordIdx].width / (double)width_);
|
||||
// float xPos = (float)(coords[coordIdx].x - 0.5 * coords[coordIdx].width);
|
||||
// float yPos = (float)(coords[coordIdx].y + 0.5 * coords[coordIdx].width);
|
||||
|
||||
// Copy memory asynchronously and concurrently from host to device
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
HIPCHECK(hipMemcpy(dPtr[i], hPtr[i], bufSize, hipMemcpyHostToDevice));
|
||||
}
|
||||
|
||||
// Synchronize to make sure all the copies are completed
|
||||
HIPCHECK(hipStreamSynchronize(nullptr));
|
||||
|
||||
int kernelIdx;
|
||||
if(testCase == 0 || testCase == 5 || testCase == 10)
|
||||
{
|
||||
kernelIdx = 0;
|
||||
}
|
||||
|
||||
else if(testCase == 1 || testCase == 6 || testCase == 11)
|
||||
{
|
||||
kernelIdx = 1;
|
||||
}
|
||||
else if(testCase == 2 || testCase == 7 || testCase == 12)
|
||||
{
|
||||
kernelIdx = 2;
|
||||
}
|
||||
else if(testCase == 3 || testCase == 8 || testCase == 13)
|
||||
{
|
||||
kernelIdx = 3;
|
||||
}
|
||||
|
||||
double totalTime = 0.0;
|
||||
|
||||
for(unsigned int k = 0; k < numLoops; k++)
|
||||
{
|
||||
if((testCase == 0 || testCase == 1 || testCase == 2 || testCase == 5 || testCase == 6 ||
|
||||
testCase == 7 || testCase == 10 || testCase == 11 || testCase == 12))
|
||||
{
|
||||
float xStep = (float) (coords[coordIdx].width / (double) width_);
|
||||
float yStep = (float) (-coords[coordIdx].width / (double) width_);
|
||||
float xPos = (float) (coords[coordIdx].x - 0.5 * coords[coordIdx].width);
|
||||
float yPos = (float) (coords[coordIdx].y + 0.5 * coords[coordIdx].width);
|
||||
|
||||
// Time the kernel execution
|
||||
auto all_start = std::chrono::steady_clock::now();
|
||||
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
(this->*p[kernelIdx])(dPtr[i],
|
||||
width_,
|
||||
xPos,
|
||||
yPos,
|
||||
xStep,
|
||||
yStep,
|
||||
maxIter,
|
||||
streams,
|
||||
blocks,
|
||||
threads_per_block,
|
||||
i);
|
||||
}
|
||||
|
||||
// Synchronize all the concurrent streams to have completed execution
|
||||
HIPCHECK(hipStreamSynchronize(0));
|
||||
|
||||
auto all_end = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> all_kernel_time = all_end - all_start;
|
||||
totalTime += all_kernel_time.count();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
double xStep = coords[coordIdx].width / (double) width_;
|
||||
double yStep = -coords[coordIdx].width / (double) width_;
|
||||
double xPos = coords[coordIdx].x - 0.5 * coords[coordIdx].width;
|
||||
double yPos = coords[coordIdx].y + 0.5 * coords[coordIdx].width;
|
||||
|
||||
// Time the kernel execution
|
||||
auto all_start = std::chrono::steady_clock::now();
|
||||
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
(this->*p[kernelIdx])(dPtr[i],
|
||||
width_,
|
||||
xPos,
|
||||
yPos,
|
||||
xStep,
|
||||
yStep,
|
||||
maxIter,
|
||||
streams,
|
||||
blocks,
|
||||
threads_per_block,
|
||||
i);
|
||||
}
|
||||
|
||||
// Synchronize all the concurrent streams to have completed execution
|
||||
HIPCHECK(hipStreamSynchronize(0));
|
||||
|
||||
auto all_end = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> all_kernel_time = all_end - all_start;
|
||||
totalTime += all_kernel_time.count();
|
||||
}
|
||||
}
|
||||
|
||||
// Copy data back from device to the host
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
HIPCHECK(hipMemcpy(hPtr[i], dPtr[i], bufSize, hipMemcpyDeviceToHost));
|
||||
}
|
||||
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
checkData(hPtr[i]);
|
||||
|
||||
int j = 0;
|
||||
while((totalIters != expectedIters[j] && totalIters > expectedIters[j]) && j < 30)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
|
||||
if(j == 30)
|
||||
{
|
||||
std::cout << "Incorrect iteration count detected. ";
|
||||
}
|
||||
}
|
||||
|
||||
// Compute GFLOPS. There are 7 FLOPs per iteration
|
||||
double perf = ((double) (totalIters * numKernels) * 7 * (double) (1e-09)) /
|
||||
(totalTime / (double) numLoops);
|
||||
|
||||
std::vector<std::string> kernelName = {"float", "float_unroll", "double", "double_unroll"};
|
||||
|
||||
// Print results except for Warm-up kernel
|
||||
if(testCase != 100)
|
||||
{
|
||||
results[kernelName[testCase % 4]].push_back(perf);
|
||||
}
|
||||
|
||||
for(uint i = 0; i < numStreams; i++)
|
||||
{
|
||||
HIPCHECK(hipStreamDestroy(streams[i]));
|
||||
}
|
||||
|
||||
// Free host and device memory
|
||||
for(uint i = 0; i < numKernels; i++)
|
||||
{
|
||||
HIPCHECK(hipHostFree(hPtr[i]));
|
||||
HIPCHECK(hipFree(dPtr[i]));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::setData(void* ptr, unsigned int value)
|
||||
{
|
||||
unsigned int* ptr2 = (unsigned int*) ptr;
|
||||
for(unsigned int i = 0; i < width_ * width_; i++)
|
||||
{
|
||||
ptr2[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
hipPerfMandelBrot::checkData(uint* ptr)
|
||||
{
|
||||
totalIters = 0;
|
||||
for(unsigned int i = 0; i < width_ * width_; i++)
|
||||
{
|
||||
totalIters += ptr[i];
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
// Default values for kernels and streams
|
||||
unsigned int numStreamsWarmup = 1, numKernelsWarmup = 1;
|
||||
unsigned int numStreamsSync = 1, numKernelsSync = 1;
|
||||
unsigned int numStreamsAsync = 2, numKernelsAsync = 2;
|
||||
|
||||
// Check for help arguments
|
||||
if(argc > 1 && (std::string(argv[1]) == "-h" || std::string(argv[1]) == "--help" ||
|
||||
std::string(argv[1]) == "help"))
|
||||
{
|
||||
std::cout << "Usage: " << argv[0]
|
||||
<< " [--warmup <numStreams>:<numKernels>] [--sync <numStreams>:<numKernels>] "
|
||||
"[--async <numStreams>:<numKernels>]"
|
||||
<< std::endl;
|
||||
std::cout << "Example: " << argv[0] << " --warmup 1:1 --sync 2:4 --async 3:6" << std::endl;
|
||||
std::exit(EXIT_SUCCESS); // Exit with success status
|
||||
}
|
||||
|
||||
// Parse command-line arguments
|
||||
for(int i = 1; i < argc; i++)
|
||||
{
|
||||
std::string arg = argv[i];
|
||||
if(arg == "--warmup" && i + 1 < argc)
|
||||
{
|
||||
std::string value = argv[++i];
|
||||
std::stringstream ss(value);
|
||||
char delimiter;
|
||||
ss >> numStreamsWarmup >> delimiter >> numKernelsWarmup;
|
||||
if(delimiter != ':' || ss.fail())
|
||||
{
|
||||
std::cerr << "Invalid format for --warmup. Expected <numStreams>:<numKernels>."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else if(arg == "--sync" && i + 1 < argc)
|
||||
{
|
||||
std::string value = argv[++i];
|
||||
std::stringstream ss(value);
|
||||
char delimiter;
|
||||
ss >> numStreamsSync >> delimiter >> numKernelsSync;
|
||||
if(delimiter != ':' || ss.fail())
|
||||
{
|
||||
std::cerr << "Invalid format for --sync. Expected <numStreams>:<numKernels>."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else if(arg == "--async" && i + 1 < argc)
|
||||
{
|
||||
std::string value = argv[++i];
|
||||
std::stringstream ss(value);
|
||||
char delimiter;
|
||||
ss >> numStreamsAsync >> delimiter >> numKernelsAsync;
|
||||
if(delimiter != ':' || ss.fail())
|
||||
{
|
||||
std::cerr << "Invalid format for --async. Expected <numStreams>:<numKernels>."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unknown argument: " << arg << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int deviceCount = 0;
|
||||
HIPCHECK(hipGetDeviceCount(&deviceCount)); // Get the number of devices
|
||||
|
||||
#pragma omp parallel for
|
||||
for(int deviceId = 0; deviceId < deviceCount; deviceId++)
|
||||
{
|
||||
hipPerfMandelBrot mandelbrotCompute;
|
||||
mandelbrotCompute.open(deviceId);
|
||||
|
||||
for(unsigned int testCase = 0; testCase < 3; testCase++)
|
||||
{
|
||||
switch(testCase)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
// Warmup-kernel - default stream executes serially
|
||||
mandelbrotCompute.setNumStreams(numStreamsWarmup);
|
||||
mandelbrotCompute.setNumKernels(numKernelsWarmup);
|
||||
mandelbrotCompute.run(100 /*Random number*/, deviceId);
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
// run all - sync
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
mandelbrotCompute.setNumStreams(numStreamsSync);
|
||||
mandelbrotCompute.setNumKernels(numKernelsSync);
|
||||
mandelbrotCompute.run(i, deviceId);
|
||||
i++;
|
||||
} while(i < 12);
|
||||
mandelbrotCompute.printResults();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
// run all - async
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
mandelbrotCompute.setNumStreams(numStreamsAsync);
|
||||
mandelbrotCompute.setNumKernels(numKernelsAsync);
|
||||
mandelbrotCompute.run(i, deviceId);
|
||||
i++;
|
||||
} while(i < 12);
|
||||
mandelbrotCompute.printResults();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
passed();
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
#include <thread>
|
||||
#ifdef __linux__
|
||||
# include <sys/sysinfo.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
// standard global variables that can be set on command line
|
||||
size_t N = 4 * 1024 * 1024;
|
||||
char memsetval = 0x42;
|
||||
int memsetD32val = 0xDEADBEEF;
|
||||
short memsetD16val = 0xDEAD;
|
||||
char memsetD8val = 0xDE;
|
||||
int iterations = 1;
|
||||
unsigned blocksPerCU = 6; // to hide latency
|
||||
unsigned threadsPerBlock = 256;
|
||||
int textureFilterMode = 0; // 0: hipFilterModePoint; 1: hipFilterModeLinear
|
||||
int p_gpuDevice = 0;
|
||||
unsigned p_verbose = 0;
|
||||
int p_tests = -1; /*which tests to run. Interpretation is left to each test. default:all*/
|
||||
int debug_test = 0;
|
||||
#ifdef _WIN64
|
||||
const char* HIP_VISIBLE_DEVICES_STR = "HIP_VISIBLE_DEVICES=";
|
||||
const char* CUDA_VISIBLE_DEVICES_STR = "CUDA_VISIBLE_DEVICES=";
|
||||
const char* PATH_SEPERATOR_STR = "\\";
|
||||
const char* NULL_DEVICE = "NUL:";
|
||||
#else
|
||||
const char* HIP_VISIBLE_DEVICES_STR = "HIP_VISIBLE_DEVICES";
|
||||
const char* CUDA_VISIBLE_DEVICES_STR = "CUDA_VISIBLE_DEVICES";
|
||||
const char* PATH_SEPERATOR_STR = "/";
|
||||
const char* NULL_DEVICE = "/dev/null";
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
// Windows does not have rand_r, use srand and rand instead.
|
||||
int
|
||||
rand_r(unsigned int* s)
|
||||
{
|
||||
srand(*s);
|
||||
return rand();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get Free Memory from the system
|
||||
static size_t
|
||||
getMemoryAmount()
|
||||
{
|
||||
#if __linux__
|
||||
struct sysinfo info;
|
||||
int _ = sysinfo(&info);
|
||||
return info.freeram / (1024 * 1024); // MB
|
||||
#elif defined(_WIN32)
|
||||
MEMORYSTATUSEX statex;
|
||||
statex.dwLength = sizeof(statex);
|
||||
GlobalMemoryStatusEx(&statex);
|
||||
return (statex.ullAvailPhys / (1024 * 1024)); // MB
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t
|
||||
getHostThreadCount(const size_t memPerThread, const size_t maxThreads)
|
||||
{
|
||||
if(memPerThread == 0) return 0;
|
||||
auto memAmount = getMemoryAmount();
|
||||
const auto processor_count = std::thread::hardware_concurrency();
|
||||
if(processor_count == 0 || memAmount == 0) return 0;
|
||||
size_t thread_count = 0;
|
||||
if((processor_count * memPerThread) < memAmount)
|
||||
thread_count = processor_count;
|
||||
else
|
||||
thread_count = reinterpret_cast<size_t>(memAmount / memPerThread);
|
||||
if(maxThreads > 0)
|
||||
{
|
||||
return (thread_count > maxThreads) ? maxThreads : thread_count;
|
||||
}
|
||||
return thread_count;
|
||||
}
|
||||
|
||||
// Function to determine if the device is of gfx11 architecture
|
||||
bool
|
||||
IsGfx11()
|
||||
{
|
||||
#if defined(__HIP_PLATFORM_NVIDIA__)
|
||||
return false;
|
||||
#elif defined(__HIP_PLATFORM_AMD__)
|
||||
int device = -1;
|
||||
hipDeviceProp_t props{};
|
||||
HIPCHECK(hipGetDevice(&device));
|
||||
HIPCHECK(hipGetDeviceProperties(&props, device));
|
||||
|
||||
// Get GCN Arch Name and compare to check if it is gfx11
|
||||
std::string arch = std::string(props.gcnArchName);
|
||||
auto pos = arch.find(":");
|
||||
if(pos != std::string::npos) arch = arch.substr(0, pos);
|
||||
|
||||
if(arch.size() >= 5) arch = arch.substr(0, 5);
|
||||
|
||||
return (arch == std::string("gfx11")) ? true : false;
|
||||
#else
|
||||
std::cout << "Have to be either Nvidia or AMD platform, asserting" << std::endl;
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace HipTest
|
||||
{
|
||||
double
|
||||
elapsed_time(long long startTimeUs, long long stopTimeUs)
|
||||
{
|
||||
return ((double) (stopTimeUs - startTimeUs)) / ((double) (1000));
|
||||
}
|
||||
|
||||
int
|
||||
parseSize(const char* str, size_t* output)
|
||||
{
|
||||
char* next;
|
||||
*output = strtoull(str, &next, 0);
|
||||
int l = strlen(str);
|
||||
if(l)
|
||||
{
|
||||
char c = str[l - 1]; // last char.
|
||||
if((c == 'k') || (c == 'K'))
|
||||
{
|
||||
*output *= 1024;
|
||||
}
|
||||
if((c == 'm') || (c == 'M'))
|
||||
{
|
||||
*output *= (1024 * 1024);
|
||||
}
|
||||
if((c == 'g') || (c == 'G'))
|
||||
{
|
||||
*output *= (1024 * 1024 * 1024);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
parseUInt(const char* str, unsigned int* output)
|
||||
{
|
||||
char* next;
|
||||
*output = strtoul(str, &next, 0);
|
||||
return !strlen(next);
|
||||
}
|
||||
|
||||
int
|
||||
parseInt(const char* str, int* output)
|
||||
{
|
||||
char* next;
|
||||
*output = strtol(str, &next, 0);
|
||||
return !strlen(next);
|
||||
}
|
||||
|
||||
int
|
||||
parseStandardArguments(int argc, char* argv[], bool failOnUndefinedArg)
|
||||
{
|
||||
int extraArgs = 1;
|
||||
for(int i = 1; i < argc; i++)
|
||||
{
|
||||
const char* arg = argv[i];
|
||||
|
||||
if(!strcmp(arg, " "))
|
||||
{
|
||||
// skip NULL args.
|
||||
}
|
||||
else if(!strcmp(arg, "--N") || (!strcmp(arg, "-N")))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseSize(argv[i], &N))
|
||||
{
|
||||
failed("Bad N size argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--threadsPerBlock"))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseUInt(argv[i], &threadsPerBlock))
|
||||
{
|
||||
failed("Bad threadsPerBlock argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--blocksPerCU"))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseUInt(argv[i], &blocksPerCU))
|
||||
{
|
||||
failed("Bad blocksPerCU argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--memsetval"))
|
||||
{
|
||||
int ex;
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &ex))
|
||||
{
|
||||
failed("Bad memsetval argument");
|
||||
}
|
||||
memsetval = ex;
|
||||
}
|
||||
else if(!strcmp(arg, "--memsetD32val"))
|
||||
{
|
||||
int ex;
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &ex))
|
||||
{
|
||||
failed("Bad memsetD32val argument");
|
||||
}
|
||||
memsetD32val = ex;
|
||||
}
|
||||
else if(!strcmp(arg, "--memsetD16val"))
|
||||
{
|
||||
int ex;
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &ex))
|
||||
{
|
||||
failed("Bad memsetD16val argument");
|
||||
}
|
||||
memsetD16val = ex;
|
||||
}
|
||||
else if(!strcmp(arg, "--memsetD8val"))
|
||||
{
|
||||
int ex;
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &ex))
|
||||
{
|
||||
failed("Bad memsetD8val argument");
|
||||
}
|
||||
memsetD8val = ex;
|
||||
}
|
||||
else if(!strcmp(arg, "--textureFilterMode"))
|
||||
{
|
||||
int mode;
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &mode))
|
||||
{
|
||||
failed("Bad textureFilterMode argument");
|
||||
}
|
||||
textureFilterMode = mode;
|
||||
}
|
||||
else if(!strcmp(arg, "--iterations") || (!strcmp(arg, "-i")))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &iterations))
|
||||
{
|
||||
failed("Bad iterations argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--gpu") || (!strcmp(arg, "-gpuDevice")) || (!strcmp(arg, "-g")))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &p_gpuDevice))
|
||||
{
|
||||
failed("Bad gpuDevice argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--verbose") || (!strcmp(arg, "-v")))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseUInt(argv[i], &p_verbose))
|
||||
{
|
||||
failed("Bad verbose argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--tests") || (!strcmp(arg, "-t")))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &p_tests))
|
||||
{
|
||||
failed("Bad tests argument");
|
||||
}
|
||||
}
|
||||
else if(!strcmp(arg, "--debug") || (!strcmp(arg, "-d")))
|
||||
{
|
||||
if(++i >= argc || !HipTest::parseInt(argv[i], &debug_test))
|
||||
{
|
||||
failed("Bad tests argument");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(failOnUndefinedArg)
|
||||
{
|
||||
failed("Bad argument '%s'", arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
argv[extraArgs++] = argv[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return extraArgs;
|
||||
}
|
||||
|
||||
unsigned
|
||||
setNumBlocks(unsigned blocksPerCU, unsigned threadsPerBlock, size_t N)
|
||||
{
|
||||
int device;
|
||||
HIPCHECK(hipGetDevice(&device));
|
||||
hipDeviceProp_t props;
|
||||
HIPCHECK(hipGetDeviceProperties(&props, device));
|
||||
|
||||
unsigned blocks = props.multiProcessorCount * blocksPerCU;
|
||||
if(blocks * threadsPerBlock > N)
|
||||
{
|
||||
blocks = (N + threadsPerBlock - 1) / threadsPerBlock;
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
} // namespace HipTest
|
||||
@@ -0,0 +1,733 @@
|
||||
/*
|
||||
Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* File is intended to C and CPP compliant hence any CPP specic changes
|
||||
* should be added into CPP section
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <iomanip>
|
||||
# include <iostream>
|
||||
# if __CUDACC__
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <chrono>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// ************************ GCC section **************************
|
||||
#include <stddef.h>
|
||||
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
|
||||
#define HC __attribute__((hc))
|
||||
|
||||
#define KNRM "\x1B[0m"
|
||||
#define KRED "\x1B[31m"
|
||||
#define KGRN "\x1B[32m"
|
||||
#define KYEL "\x1B[33m"
|
||||
#define KBLU "\x1B[34m"
|
||||
#define KMAG "\x1B[35m"
|
||||
#define KCYN "\x1B[36m"
|
||||
#define KWHT "\x1B[37m"
|
||||
|
||||
// HIP Skip Return code set at cmake
|
||||
#define HIP_SKIP_RETURN_CODE 127
|
||||
#define HIP_ENABLE_SKIP_TESTS 0
|
||||
|
||||
// Recommended thresholds for Tests
|
||||
#define MAX_THREADS 100
|
||||
|
||||
inline bool
|
||||
hip_skip_tests_enabled()
|
||||
{
|
||||
return HIP_ENABLE_SKIP_TESTS;
|
||||
}
|
||||
|
||||
inline int
|
||||
hip_skip_retcode()
|
||||
{
|
||||
// HIP Skip Return code set at cmake
|
||||
return HIP_SKIP_RETURN_CODE;
|
||||
}
|
||||
|
||||
// This must be called in the end of main() to indicate test passed with success.
|
||||
// If it's called somewhere else, compiling issues or unexpected result will arise.
|
||||
#define passed() \
|
||||
printf("%sPASSED!%s\n", KGRN, KNRM); \
|
||||
return 0;
|
||||
|
||||
// The real "assert" would have written to stderr. But it is
|
||||
// sufficient to just fflush here without getting pedantic. This also
|
||||
// ensures that we don't lose any earlier writes to stdout.
|
||||
#define failed(...) \
|
||||
printf("%serror: ", KRED); \
|
||||
printf(__VA_ARGS__); \
|
||||
printf("\n"); \
|
||||
printf("error: TEST FAILED\n%s", KNRM); \
|
||||
fflush(NULL); \
|
||||
abort();
|
||||
|
||||
#define warn(...) \
|
||||
printf("%swarn: ", KYEL); \
|
||||
printf(__VA_ARGS__); \
|
||||
printf("\n"); \
|
||||
printf("warn: TEST WARNING\n%s", KNRM);
|
||||
|
||||
#define HIP_PRINT_STATUS(status) \
|
||||
std::cout << hipGetErrorName(status) << " at line: " << __LINE__ << std::endl;
|
||||
|
||||
#define HIPCHECK(error) \
|
||||
{ \
|
||||
hipError_t localError = error; \
|
||||
if((localError != hipSuccess) && (localError != hipErrorPeerAccessAlreadyEnabled)) \
|
||||
{ \
|
||||
printf("%serror: '%s'(%d) from %s at %s:%d%s\n", \
|
||||
KRED, \
|
||||
hipGetErrorString(localError), \
|
||||
localError, \
|
||||
#error, \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
KNRM); \
|
||||
failed("API returned error code."); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define HIPASSERT(condition) \
|
||||
if(!(condition)) \
|
||||
{ \
|
||||
failed("%sassertion %s at %s:%d%s \n", KRED, #condition, __FILE__, __LINE__, KNRM); \
|
||||
}
|
||||
|
||||
#define HIPCHECK_API(API_CALL, EXPECTED_ERROR) \
|
||||
{ \
|
||||
hipError_t _e = (API_CALL); \
|
||||
if(_e != (EXPECTED_ERROR)) \
|
||||
{ \
|
||||
failed("%sAPI '%s' returned %d(%s) but test expected %d(%s) at %s:%d%s \n", \
|
||||
KRED, \
|
||||
#API_CALL, \
|
||||
_e, \
|
||||
hipGetErrorName(_e), \
|
||||
EXPECTED_ERROR, \
|
||||
hipGetErrorName(EXPECTED_ERROR), \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
KNRM); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define HIPCHECK_RETURN_ONFAIL(func) \
|
||||
do \
|
||||
{ \
|
||||
hipError_t herror = (func); \
|
||||
if(herror != hipSuccess) \
|
||||
{ \
|
||||
return herror; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#ifdef _WIN64
|
||||
# include <tchar.h>
|
||||
# define aligned_alloc(x, y) _aligned_malloc(y, x)
|
||||
# define aligned_free(x) _aligned_free(x)
|
||||
# define popen(x, y) _popen(x, y)
|
||||
# define pclose(x) _pclose(x)
|
||||
# define setenv(x, y, z) _putenv_s(x, y)
|
||||
# define unsetenv _putenv
|
||||
# define fileno(x) _fileno(x)
|
||||
# define dup(x) _dup(x)
|
||||
# define dup2(x, y) _dup2(x, y)
|
||||
# define pipe(x, y, z) _pipe(x, y, z)
|
||||
# define sleep(x) _sleep(x)
|
||||
#else
|
||||
# define aligned_free(x) free(x)
|
||||
#endif
|
||||
|
||||
// standard command-line variables:
|
||||
extern size_t N;
|
||||
extern char memsetval;
|
||||
extern int memsetD32val;
|
||||
extern short memsetD16val;
|
||||
extern char memsetD8val;
|
||||
extern int iterations;
|
||||
extern unsigned blocksPerCU;
|
||||
extern unsigned threadsPerBlock;
|
||||
extern int textureFilterMode;
|
||||
extern int p_gpuDevice;
|
||||
extern unsigned p_verbose;
|
||||
extern int p_tests;
|
||||
extern int debug_test;
|
||||
extern const char* HIP_VISIBLE_DEVICES_STR;
|
||||
extern const char* CUDA_VISIBLE_DEVICES_STR;
|
||||
extern const char* PATH_SEPERATOR_STR;
|
||||
extern const char* NULL_DEVICE;
|
||||
|
||||
// ********************* CPP section *********************
|
||||
#ifdef __cplusplus
|
||||
|
||||
# ifdef __HIP_PLATFORM_HCC
|
||||
# define TYPENAME(T) typeid(T).name()
|
||||
# else
|
||||
# define TYPENAME(T) "?"
|
||||
# endif
|
||||
|
||||
# ifdef _WIN64
|
||||
int
|
||||
rand_r(unsigned int* s);
|
||||
# endif
|
||||
|
||||
// Get Optimal Thread count size
|
||||
size_t
|
||||
getHostThreadCount(const size_t memPerThread = 200 /* MB */, const size_t maxThreads = 0);
|
||||
|
||||
namespace HipTest
|
||||
{
|
||||
// Returns the current system time in microseconds
|
||||
inline long long
|
||||
get_time()
|
||||
{
|
||||
# if __CUDACC__
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
return (tv.tv_sec * 1000000) + tv.tv_usec;
|
||||
# else
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch() /
|
||||
std::chrono::microseconds(1);
|
||||
# endif
|
||||
}
|
||||
|
||||
double
|
||||
elapsed_time(long long startTimeUs, long long stopTimeUs);
|
||||
|
||||
int
|
||||
parseSize(const char* str, size_t* output);
|
||||
int
|
||||
parseUInt(const char* str, unsigned int* output);
|
||||
int
|
||||
parseInt(const char* str, int* output);
|
||||
int
|
||||
parseStandardArguments(int argc, char* argv[], bool failOnUndefinedArg);
|
||||
|
||||
unsigned
|
||||
setNumBlocks(unsigned blocksPerCU, unsigned threadsPerBlock, size_t N);
|
||||
|
||||
template <typename T> // pointer type
|
||||
void
|
||||
checkArray(T hData, T hOutputData, size_t width, size_t height, size_t depth)
|
||||
{
|
||||
for([[maybe_unused]] size_t i = 0; i < depth; i++)
|
||||
{
|
||||
for([[maybe_unused]] size_t j = 0; j < height; j++)
|
||||
{
|
||||
for([[maybe_unused]] size_t k = 0; k < width; k++)
|
||||
{
|
||||
int offset = i * width * height + j * width + k;
|
||||
if(hData[offset] != hOutputData[offset])
|
||||
{
|
||||
std::cerr << '[' << i << ',' << j << ',' << k << "]:" << hData[offset] << "----"
|
||||
<< hOutputData[offset] << " ";
|
||||
failed("mistmatch at:%d %d %d", i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
checkArray(T input, T output, size_t height, size_t width)
|
||||
{
|
||||
for(size_t i = 0; i < height; i++)
|
||||
{
|
||||
for(size_t j = 0; j < width; j++)
|
||||
{
|
||||
int offset = i * width + j;
|
||||
if(input[offset] != output[offset])
|
||||
{
|
||||
std::cerr << '[' << i << ',' << j << ',' << "]:" << input[offset] << "----"
|
||||
<< output[offset] << " ";
|
||||
failed("mistmatch at:%d %d", i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
vectorADD(const T* A_d, const T* B_d, T* C_d, size_t NELEM)
|
||||
{
|
||||
size_t offset = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
size_t stride = blockDim.x * gridDim.x;
|
||||
|
||||
for(size_t i = offset; i < NELEM; i += stride)
|
||||
{
|
||||
C_d[i] = A_d[i] + B_d[i];
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
vectorADDReverse(const T* A_d, const T* B_d, T* C_d, size_t NELEM)
|
||||
{
|
||||
size_t offset = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
size_t stride = blockDim.x * gridDim.x;
|
||||
|
||||
for(int64_t i = NELEM - stride + offset; i >= 0; i -= stride)
|
||||
{
|
||||
C_d[i] = A_d[i] + B_d[i];
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
addCount(const T* A_d, T* C_d, size_t NELEM, int count)
|
||||
{
|
||||
size_t offset = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
size_t stride = blockDim.x * gridDim.x;
|
||||
|
||||
// Deliberately do this in an inefficient way to increase kernel runtime
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
for(size_t i = offset; i < NELEM; i += stride)
|
||||
{
|
||||
C_d[i] = A_d[i] + (T) count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
addCountReverse(const T* A_d, T* C_d, int64_t NELEM, int count)
|
||||
{
|
||||
size_t offset = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
size_t stride = blockDim.x * gridDim.x;
|
||||
|
||||
// Deliberately do this in an inefficient way to increase kernel runtime
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
for(int64_t i = NELEM - stride + offset; i >= 0; i -= stride)
|
||||
{
|
||||
C_d[i] = A_d[i] + (T) count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__global__ void
|
||||
memsetReverse(T* C_d, T val, int64_t NELEM)
|
||||
{
|
||||
size_t offset = (blockIdx.x * blockDim.x + threadIdx.x);
|
||||
size_t stride = blockDim.x * gridDim.x;
|
||||
|
||||
for(int64_t i = NELEM - stride + offset; i >= 0; i -= stride)
|
||||
{
|
||||
C_d[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
setDefaultData(size_t numElements, T* A_h, T* B_h, T* C_h)
|
||||
{
|
||||
// Initialize the host data:
|
||||
for(size_t i = 0; i < numElements; i++)
|
||||
{
|
||||
if(A_h) (A_h)[i] = 3.146f + i; // Pi
|
||||
if(B_h) (B_h)[i] = 1.618f + i; // Phi
|
||||
if(C_h) (C_h)[i] = 0.0f + i;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
initArraysForHost(T** A_h, T** B_h, T** C_h, size_t N, bool usePinnedHost = false)
|
||||
{
|
||||
size_t Nbytes = N * sizeof(T);
|
||||
|
||||
if(usePinnedHost)
|
||||
{
|
||||
if(A_h)
|
||||
{
|
||||
HIPCHECK(hipHostMalloc(reinterpret_cast<void**>(A_h), Nbytes));
|
||||
}
|
||||
if(B_h)
|
||||
{
|
||||
HIPCHECK(hipHostMalloc(reinterpret_cast<void**>(B_h), Nbytes));
|
||||
}
|
||||
if(C_h)
|
||||
{
|
||||
HIPCHECK(hipHostMalloc(reinterpret_cast<void**>(C_h), Nbytes));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(A_h)
|
||||
{
|
||||
*A_h = (T*) malloc(Nbytes);
|
||||
HIPASSERT(*A_h != NULL);
|
||||
}
|
||||
|
||||
if(B_h)
|
||||
{
|
||||
*B_h = (T*) malloc(Nbytes);
|
||||
HIPASSERT(*B_h != NULL);
|
||||
}
|
||||
|
||||
if(C_h)
|
||||
{
|
||||
*C_h = (T*) malloc(Nbytes);
|
||||
HIPASSERT(*C_h != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
setDefaultData(N, A_h ? *A_h : NULL, B_h ? *B_h : NULL, C_h ? *C_h : NULL);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
initArrays(T** A_d,
|
||||
T** B_d,
|
||||
T** C_d,
|
||||
T** A_h,
|
||||
T** B_h,
|
||||
T** C_h,
|
||||
size_t N,
|
||||
bool usePinnedHost = false)
|
||||
{
|
||||
size_t Nbytes = N * sizeof(T);
|
||||
|
||||
if(A_d)
|
||||
{
|
||||
HIPCHECK(hipMalloc(A_d, Nbytes));
|
||||
}
|
||||
if(B_d)
|
||||
{
|
||||
HIPCHECK(hipMalloc(B_d, Nbytes));
|
||||
}
|
||||
if(C_d)
|
||||
{
|
||||
HIPCHECK(hipMalloc(C_d, Nbytes));
|
||||
}
|
||||
|
||||
initArraysForHost(A_h, B_h, C_h, N, usePinnedHost);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
freeArraysForHost(T* A_h, T* B_h, T* C_h, bool usePinnedHost)
|
||||
{
|
||||
if(usePinnedHost)
|
||||
{
|
||||
if(A_h)
|
||||
{
|
||||
HIPCHECK(hipHostFree(A_h));
|
||||
}
|
||||
if(B_h)
|
||||
{
|
||||
HIPCHECK(hipHostFree(B_h));
|
||||
}
|
||||
if(C_h)
|
||||
{
|
||||
HIPCHECK(hipHostFree(C_h));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(A_h)
|
||||
{
|
||||
free(A_h);
|
||||
}
|
||||
if(B_h)
|
||||
{
|
||||
free(B_h);
|
||||
}
|
||||
if(C_h)
|
||||
{
|
||||
free(C_h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
freeArrays(T* A_d, T* B_d, T* C_d, T* A_h, T* B_h, T* C_h, bool usePinnedHost)
|
||||
{
|
||||
if(A_d)
|
||||
{
|
||||
HIPCHECK(hipFree(A_d));
|
||||
}
|
||||
if(B_d)
|
||||
{
|
||||
HIPCHECK(hipFree(B_d));
|
||||
}
|
||||
if(C_d)
|
||||
{
|
||||
HIPCHECK(hipFree(C_d));
|
||||
}
|
||||
|
||||
freeArraysForHost(A_h, B_h, C_h, usePinnedHost);
|
||||
}
|
||||
|
||||
# if defined(__HIP_PLATFORM_AMD__)
|
||||
template <typename T>
|
||||
void
|
||||
initArrays2DPitch(T** A_d,
|
||||
T** B_d,
|
||||
T** C_d,
|
||||
size_t* pitch_A,
|
||||
size_t* pitch_B,
|
||||
size_t* pitch_C,
|
||||
size_t numW,
|
||||
size_t numH)
|
||||
{
|
||||
if(A_d)
|
||||
{
|
||||
HIPCHECK(hipMallocPitch((void**) A_d, pitch_A, numW * sizeof(T), numH));
|
||||
}
|
||||
if(B_d)
|
||||
{
|
||||
HIPCHECK(hipMallocPitch((void**) B_d, pitch_B, numW * sizeof(T), numH));
|
||||
}
|
||||
if(C_d)
|
||||
{
|
||||
HIPCHECK(hipMallocPitch((void**) C_d, pitch_C, numW * sizeof(T), numH));
|
||||
}
|
||||
|
||||
HIPASSERT(*pitch_A == *pitch_B);
|
||||
HIPASSERT(*pitch_A == *pitch_C)
|
||||
}
|
||||
|
||||
inline void
|
||||
initHIPArrays(hipArray** A_d,
|
||||
hipArray** B_d,
|
||||
hipArray** C_d,
|
||||
const hipChannelFormatDesc* desc,
|
||||
const size_t numW,
|
||||
const size_t numH,
|
||||
const unsigned int flags)
|
||||
{
|
||||
if(A_d)
|
||||
{
|
||||
HIPCHECK(hipMallocArray(A_d, desc, numW, numH, flags));
|
||||
}
|
||||
if(B_d)
|
||||
{
|
||||
HIPCHECK(hipMallocArray(B_d, desc, numW, numH, flags));
|
||||
}
|
||||
if(C_d)
|
||||
{
|
||||
HIPCHECK(hipMallocArray(C_d, desc, numW, numH, flags));
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
// Assumes C_h contains vector add of A_h + B_h
|
||||
// Calls the test "failed" macro if a mismatch is detected.
|
||||
template <typename T>
|
||||
size_t
|
||||
checkVectorADD(T* A_h,
|
||||
T* B_h,
|
||||
T* result_H,
|
||||
size_t N,
|
||||
bool expectMatch = true,
|
||||
bool reportMismatch = true)
|
||||
{
|
||||
size_t mismatchCount = 0;
|
||||
size_t firstMismatch = 0;
|
||||
size_t mismatchesToPrint = 10;
|
||||
for(size_t i = 0; i < N; i++)
|
||||
{
|
||||
T expected = A_h[i] + B_h[i];
|
||||
if(result_H[i] != expected)
|
||||
{
|
||||
if(mismatchCount == 0)
|
||||
{
|
||||
firstMismatch = i;
|
||||
}
|
||||
mismatchCount++;
|
||||
if((mismatchCount <= mismatchesToPrint) && expectMatch)
|
||||
{
|
||||
std::cout << std::fixed << std::setprecision(32);
|
||||
std::cout << "At " << i << std::endl;
|
||||
std::cout << " Computed:" << result_H[i] << std::endl;
|
||||
std::cout << " Expected:" << expected << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(reportMismatch)
|
||||
{
|
||||
if(expectMatch)
|
||||
{
|
||||
if(mismatchCount)
|
||||
{
|
||||
failed("%zu mismatches ; first at index:%zu\n", mismatchCount, firstMismatch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mismatchCount == 0)
|
||||
{
|
||||
failed("expected mismatches but did not detect any!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mismatchCount;
|
||||
}
|
||||
|
||||
// Assumes C_h contains vector add of A_h + B_h
|
||||
// Calls the test "failed" macro if a mismatch is detected.
|
||||
template <typename T>
|
||||
void
|
||||
checkTest(T* expected_H, T* result_H, size_t N, bool expectMatch = true)
|
||||
{
|
||||
size_t mismatchCount = 0;
|
||||
size_t firstMismatch = 0;
|
||||
size_t mismatchesToPrint = 10;
|
||||
for(size_t i = 0; i < N; i++)
|
||||
{
|
||||
if(result_H[i] != expected_H[i])
|
||||
{
|
||||
if(mismatchCount == 0)
|
||||
{
|
||||
firstMismatch = i;
|
||||
}
|
||||
mismatchCount++;
|
||||
if((mismatchCount <= mismatchesToPrint) && expectMatch)
|
||||
{
|
||||
std::cout << std::fixed << std::setprecision(32);
|
||||
std::cout << "At " << i << std::endl;
|
||||
std::cout << " Computed:" << result_H[i] << std::endl;
|
||||
std::cout << " Expected:" << expected_H[i] << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(expectMatch)
|
||||
{
|
||||
if(mismatchCount)
|
||||
{
|
||||
fprintf(stderr, "%zu mismatches ; first at index:%zu\n", mismatchCount, firstMismatch);
|
||||
// failed("%zu mismatches ; first at index:%zu\n", mismatchCount, firstMismatch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mismatchCount == 0)
|
||||
{
|
||||
failed("expected mismatches but did not detect any!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---
|
||||
struct Pinned
|
||||
{
|
||||
static const bool isPinned = true;
|
||||
static const char* str() { return "Pinned"; };
|
||||
|
||||
static void* Alloc(size_t sizeBytes)
|
||||
{
|
||||
void* p;
|
||||
HIPCHECK(hipHostMalloc((void**) &p, sizeBytes));
|
||||
return p;
|
||||
};
|
||||
};
|
||||
|
||||
//---
|
||||
struct Unpinned
|
||||
{
|
||||
static const bool isPinned = false;
|
||||
static const char* str() { return "Unpinned"; };
|
||||
|
||||
static void* Alloc(size_t sizeBytes)
|
||||
{
|
||||
void* p = malloc(sizeBytes);
|
||||
HIPASSERT(p);
|
||||
return p;
|
||||
};
|
||||
};
|
||||
|
||||
struct Memcpy
|
||||
{
|
||||
static const char* str() { return "Memcpy"; };
|
||||
};
|
||||
|
||||
struct MemcpyAsync
|
||||
{
|
||||
static const char* str() { return "MemcpyAsync"; };
|
||||
};
|
||||
|
||||
template <typename C>
|
||||
struct MemTraits;
|
||||
|
||||
template <>
|
||||
struct MemTraits<Memcpy>
|
||||
{
|
||||
static void Copy(void* dest, const void* src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t)
|
||||
{
|
||||
HIPCHECK(hipMemcpy(dest, src, sizeBytes, kind));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct MemTraits<MemcpyAsync>
|
||||
{
|
||||
static void Copy(void* dest,
|
||||
const void* src,
|
||||
size_t sizeBytes,
|
||||
hipMemcpyKind kind,
|
||||
hipStream_t stream)
|
||||
{
|
||||
HIPCHECK(hipMemcpyAsync(dest, src, sizeBytes, kind, stream));
|
||||
}
|
||||
};
|
||||
|
||||
inline bool
|
||||
isImageSupported()
|
||||
{
|
||||
int imageSupport = 1;
|
||||
# ifdef __HIP_PLATFORM_AMD__
|
||||
HIPCHECK(hipDeviceGetAttribute(&imageSupport, hipDeviceAttributeImageSupport, p_gpuDevice));
|
||||
# endif
|
||||
return imageSupport != 0;
|
||||
}
|
||||
|
||||
}; // namespace HipTest
|
||||
|
||||
// This must be called in the beginning of image test app's main() to indicate whether image
|
||||
// is supported.
|
||||
# define checkImageSupport() \
|
||||
if(!HipTest::isImageSupported()) \
|
||||
{ \
|
||||
printf("Texture is not support on the device. Skipped.\n"); \
|
||||
passed(); \
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
// Function to determine if the device is of gfx11 architecture
|
||||
bool
|
||||
IsGfx11();
|
||||
+1487
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
# install the downloaded timem libraries
|
||||
install(
|
||||
DIRECTORY ${PROJECT_BINARY_DIR}/lib64/
|
||||
DESTINATION ${CMAKE_INSTALL_LIB64DIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*libtimem.*"
|
||||
PATTERN "*/timemory/*")
|
||||
@@ -0,0 +1,5 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
add_subdirectory(rocprofiler-sdk)
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
set(DATA_FILES benchmark_tables.sql benchmark_views.sql)
|
||||
|
||||
foreach(_FILE ${DATA_FILES})
|
||||
configure_file(${_FILE} ${CMAKE_DATAROOT_OUTPUT_DIRECTORY}/rocprofiler-sdk/${_FILE}
|
||||
COPYONLY)
|
||||
endforeach()
|
||||
|
||||
install(FILES ${DATA_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-sdk)
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
-- Application used for benchmarking
|
||||
-- Columns such "hip_compiler_api", ..., "scratch_memory" are
|
||||
-- the number of events in the given category, e.g. kernel_dispatch
|
||||
-- represents the number of kernel dispatches in the app. These
|
||||
-- can be approximate since for a given application, the exact
|
||||
-- count may vary.
|
||||
CREATE TABLE IF NOT EXISTS
|
||||
`benchmarked_app` (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT UNIQUE,
|
||||
hash_id TEXT NOT NULL,
|
||||
md5sum TEXT NOT NULL,
|
||||
revision INT DEFAULT 0,
|
||||
command JSON NOT NULL,
|
||||
compiler_id TEXT,
|
||||
compiler_version TEXT,
|
||||
library_arch TEXT,
|
||||
system_name TEXT,
|
||||
system_processor TEXT,
|
||||
system_version TEXT,
|
||||
threads INT,
|
||||
hip_compiler_api INT,
|
||||
hip_runtime_api INT,
|
||||
hsa_api INT,
|
||||
kernel_dispatch INT,
|
||||
marker_api INT,
|
||||
memory_allocation INT,
|
||||
memory_copy INT,
|
||||
ompt INT,
|
||||
rccl_api INT,
|
||||
rocdecode_api INT,
|
||||
rocjpeg_api INT,
|
||||
scratch_memory INT,
|
||||
environment JSON DEFAULT ("{}")
|
||||
);
|
||||
|
||||
-- rocprofiler-sdk used for benchmarking
|
||||
CREATE TABLE IF NOT EXISTS
|
||||
`benchmarked_sdk` (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT UNIQUE,
|
||||
hash_id TEXT NOT NULL,
|
||||
version_major INT NOT NULL,
|
||||
version_minor INT NOT NULL,
|
||||
version_patch INT NOT NULL,
|
||||
soversion INT NOT NULL,
|
||||
compiler_id TEXT NOT NULL,
|
||||
compiler_version TEXT NOT NULL,
|
||||
git_revision TEXT NOT NULL,
|
||||
library_arch TEXT NOT NULL,
|
||||
system_name TEXT NOT NULL,
|
||||
system_processor TEXT NOT NULL,
|
||||
system_version TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- rocprofiler-sdk used for benchmarking
|
||||
CREATE TABLE IF NOT EXISTS
|
||||
`benchmark_config` (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT UNIQUE,
|
||||
hash_id TEXT NOT NULL,
|
||||
sdk_id INT,
|
||||
label TEXT, -- name identifier
|
||||
benchmark_mode TEXT CHECK (
|
||||
benchmark_mode IN (
|
||||
"baseline",
|
||||
"disabled-sdk-contexts",
|
||||
"sdk-buffer-overhead",
|
||||
"sdk-callback-overhead",
|
||||
"tool-runtime-overhead"
|
||||
)
|
||||
) NOT NULL,
|
||||
kernel_rename INT,
|
||||
group_by_queue INT,
|
||||
kernel_trace INT,
|
||||
hsa_trace INT,
|
||||
hip_runtime_trace INT,
|
||||
hip_compiler_trace INT,
|
||||
marker_trace INT,
|
||||
memory_copy_trace INT,
|
||||
memory_allocation_trace INT,
|
||||
scratch_memory_trace INT,
|
||||
dispatch_counter_collection INT,
|
||||
rccl_trace INT,
|
||||
rocdecode_trace INT,
|
||||
rocjpeg_trace INT,
|
||||
pmc_counters JSON DEFAULT ("[]"),
|
||||
pc_sampling_host_trap INT,
|
||||
pc_sampling_stocastic INT,
|
||||
advanced_thread_trace INT,
|
||||
--
|
||||
-- Eventually, we will create tables for storing the subconfigurations for pc sampling and ATT
|
||||
--
|
||||
-- pc_sampling_host_trap_config_id INT,
|
||||
-- pc_sampling_stocastic_config_id INT,
|
||||
-- advanced_thread_trace_config_id INT,
|
||||
-- FOREIGN KEY (pc_sampling_host_trap_config_id) REFERENCES benchmark_pc_sampling_host_trap_config (id) ON UPDATE CASCADE,
|
||||
-- FOREIGN KEY (pc_sampling_stocastic_config_id) REFERENCES benchmark_pc_sampling_stocastic_config (id) ON UPDATE CASCADE,
|
||||
-- FOREIGN KEY (advanced_thread_trace_config_id) REFERENCES benchmark_advanced_thread_trace_config (id) ON UPDATE CASCADE
|
||||
FOREIGN KEY (sdk_id) REFERENCES benchmarked_sdk (id) ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- metrics for the benchmark
|
||||
CREATE TABLE IF NOT EXISTS
|
||||
`benchmark_metrics` (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT UNIQUE,
|
||||
app_id INT NOT NULL,
|
||||
cfg_id INT NOT NULL,
|
||||
sdk_id INT,
|
||||
executed_at TIMESTAMP NOT NULL,
|
||||
wall_time DOUBLE NOT NULL,
|
||||
cpu_time DOUBLE NOT NULL,
|
||||
cpu_util DOUBLE NOT NULL,
|
||||
peak_rss DOUBLE NOT NULL,
|
||||
page_rss DOUBLE NOT NULL,
|
||||
virtual_memory DOUBLE NOT NULL,
|
||||
major_page_faults BIGINT NOT NULL,
|
||||
minor_page_faults BIGINT NOT NULL,
|
||||
priority_context_switches BIGINT NOT NULL,
|
||||
voluntary_context_switches BIGINT NOT NULL,
|
||||
FOREIGN KEY (app_id) REFERENCES benchmarked_app (id) ON UPDATE CASCADE,
|
||||
FOREIGN KEY (cfg_id) REFERENCES benchmark_config (id) ON UPDATE CASCADE,
|
||||
FOREIGN KEY (sdk_id) REFERENCES benchmarked_sdk (id) ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS
|
||||
`benchmark_statistics` (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT UNIQUE,
|
||||
app_id INT NOT NULL,
|
||||
cfg_id INT NOT NULL,
|
||||
sdk_id INT,
|
||||
metric_name TEXT NOT NULL,
|
||||
metric_unit TEXT NOT NULL,
|
||||
count INT NOT NULL,
|
||||
sum DOUBLE NOT NULL,
|
||||
mean DOUBLE NOT NULL,
|
||||
min DOUBLE NOT NULL,
|
||||
max DOUBLE NOT NULL,
|
||||
std_dev DOUBLE
|
||||
);
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
-- Analysis views used for benchmarking
|
||||
CREATE VIEW IF NOT EXISTS
|
||||
`benchmark_analysis_{{metric}}` AS
|
||||
WITH
|
||||
baseline AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
benchmark_statistics BL
|
||||
WHERE
|
||||
BL.sdk_id IS NULL
|
||||
AND BL.metric_name = "{{metric}}"
|
||||
)
|
||||
SELECT
|
||||
ST.id,
|
||||
ST.app_id,
|
||||
ST.cfg_id,
|
||||
ST.sdk_id,
|
||||
BS.git_revision,
|
||||
BA.command,
|
||||
ST.metric_name,
|
||||
ST.metric_unit,
|
||||
ST.count,
|
||||
ST.mean,
|
||||
ST.std_dev AS `+/-`,
|
||||
BL.mean AS baseline_mean,
|
||||
BL.std_dev AS `+/- (baseline)`,
|
||||
((ST.mean - BL.mean) / BL.mean) * 100 AS `overhead (%)`,
|
||||
BC.benchmark_mode,
|
||||
BC.label AS benchmark_label
|
||||
FROM
|
||||
benchmark_statistics ST
|
||||
JOIN benchmark_config BC ON BC.id = ST.cfg_id
|
||||
JOIN benchmarked_sdk BS ON BS.id = ST.sdk_id
|
||||
JOIN benchmarked_app BA ON BA.id = ST.app_id
|
||||
JOIN baseline BL ON (
|
||||
BL.app_id = ST.app_id
|
||||
AND BL.metric_name = ST.metric_name
|
||||
)
|
||||
WHERE
|
||||
ST.metric_name = "{{metric}}"
|
||||
AND ST.sdk_id IS NOT NULL
|
||||
ORDER BY
|
||||
`overhead (%)` DESC;
|
||||
|
||||
-- benchmarked_app without environment info
|
||||
CREATE VIEW IF NOT EXISTS
|
||||
`benchmarked_app_without_env` AS
|
||||
SELECT
|
||||
id,
|
||||
hash_id,
|
||||
md5sum,
|
||||
revision,
|
||||
command,
|
||||
compiler_id,
|
||||
compiler_version,
|
||||
library_arch,
|
||||
system_name,
|
||||
system_processor,
|
||||
system_version,
|
||||
threads,
|
||||
hip_compiler_api,
|
||||
hip_runtime_api,
|
||||
hsa_api,
|
||||
kernel_dispatch,
|
||||
marker_api,
|
||||
memory_allocation,
|
||||
memory_copy,
|
||||
ompt,
|
||||
rccl_api,
|
||||
rocdecode_api,
|
||||
rocjpeg_api,
|
||||
scratch_memory
|
||||
FROM
|
||||
benchmarked_app;
|
||||
@@ -0,0 +1,94 @@
|
||||
# Try to find libdw headers and libraries.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(libdw)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# libdw_ROOT Set this variable to the root installation of
|
||||
# libdw if the module has problems finding the
|
||||
# proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# libdw_FOUND System has libdw libraries and headers
|
||||
# libdw_LIBRARIES The libdw library
|
||||
# libdw_INCLUDE_DIRS The location of libdw headers
|
||||
#
|
||||
# Interface targets defined by this module:
|
||||
#
|
||||
# libdw::libdw
|
||||
#
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(PkgConfig_FOUND)
|
||||
set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "")
|
||||
pkg_check_modules(DW libdw)
|
||||
|
||||
if(DW_FOUND
|
||||
AND DW_INCLUDE_DIRS
|
||||
AND DW_LINK_LIBRARIES)
|
||||
set(libdw_INCLUDE_DIR
|
||||
"${DW_INCLUDE_DIRS}"
|
||||
CACHE FILEPATH "libdw include directory")
|
||||
set(libdw_LIBRARY
|
||||
"${DW_LINK_LIBRARIES}"
|
||||
CACHE FILEPATH "libdw libraries")
|
||||
if(DW_PREFIX)
|
||||
set(libdw_ROOT_DIR
|
||||
"${DW_PREFIX}"
|
||||
CACHE FILEPATH "libdw root directory")
|
||||
endif()
|
||||
|
||||
if(DW_VERSION)
|
||||
set(libdw_VERSION
|
||||
"${DW_VERSION}"
|
||||
CACHE FILEPATH "libdw version")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT libdw_INCLUDE_DIR OR NOT libdw_LIBRARY)
|
||||
find_path(
|
||||
libdw_ROOT_DIR
|
||||
NAMES include/elfutils/libdw.h
|
||||
HINTS ${libdw_ROOT}
|
||||
PATHS ${libdw_ROOT})
|
||||
|
||||
mark_as_advanced(libdw_ROOT_DIR)
|
||||
|
||||
find_path(
|
||||
libdw_INCLUDE_DIR
|
||||
NAMES elfutils/libdw.h
|
||||
HINTS ${libdw_ROOT}
|
||||
PATHS ${libdw_ROOT}
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
find_library(
|
||||
libdw_LIBRARY
|
||||
NAMES dw
|
||||
HINTS ${libdw_ROOT}
|
||||
PATHS ${libdw_ROOT}
|
||||
PATH_SUFFIXES lib lib64)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(libdw DEFAULT_MSG libdw_LIBRARY libdw_INCLUDE_DIR)
|
||||
|
||||
if(libdw_FOUND)
|
||||
if(NOT TARGET libdw::libdw)
|
||||
add_library(libdw::libdw INTERFACE IMPORTED)
|
||||
|
||||
if(TARGET PkgConfig::DW AND DW_FOUND)
|
||||
target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW)
|
||||
else()
|
||||
target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY})
|
||||
target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(libdw_INCLUDE_DIR libdw_LIBRARY)
|
||||
@@ -0,0 +1,83 @@
|
||||
# Try to find libelf headers and libraries.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(libelf)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# libelf_ROOT Set this variable to the root installation of
|
||||
# libelf if the module has problems finding the
|
||||
# proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# libelf_FOUND System has libelf libraries and headers
|
||||
# libelf_LIBRARIES The libelf library
|
||||
# libelf_INCLUDE_DIRS The location of libelf headers
|
||||
#
|
||||
# Interface targets defined by this module:
|
||||
#
|
||||
# libelf::libelf
|
||||
#
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(PkgConfig_FOUND)
|
||||
set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "")
|
||||
pkg_check_modules(ELF libelf)
|
||||
|
||||
if(ELF_FOUND
|
||||
AND ELF_INCLUDE_DIRS
|
||||
AND ELF_LIBRARIES)
|
||||
set(libelf_INCLUDE_DIR
|
||||
"${ELF_INCLUDE_DIRS}"
|
||||
CACHE FILEPATH "libelf include directory")
|
||||
set(libelf_LIBRARY
|
||||
"${ELF_LIBRARIES}"
|
||||
CACHE FILEPATH "libelf libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT libelf_INCLUDE_DIR OR NOT libelf_LIBRARY)
|
||||
find_path(
|
||||
libelf_ROOT_DIR
|
||||
NAMES include/elf.h
|
||||
HINTS ${libelf_ROOT}
|
||||
PATHS ${libelf_ROOT})
|
||||
|
||||
mark_as_advanced(libelf_ROOT_DIR)
|
||||
|
||||
find_path(
|
||||
libelf_INCLUDE_DIR
|
||||
NAMES elf.h
|
||||
HINTS ${libelf_ROOT}
|
||||
PATHS ${libelf_ROOT}
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
find_library(
|
||||
libelf_LIBRARY
|
||||
NAMES elf
|
||||
HINTS ${libelf_ROOT}
|
||||
PATHS ${libelf_ROOT}
|
||||
PATH_SUFFIXES lib lib64)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(libelf DEFAULT_MSG libelf_LIBRARY libelf_INCLUDE_DIR)
|
||||
|
||||
if(libelf_FOUND)
|
||||
if(NOT TARGET libelf::libelf)
|
||||
add_library(libelf::libelf INTERFACE IMPORTED)
|
||||
endif()
|
||||
|
||||
if(TARGET PkgConfig::ELF AND ELF_FOUND)
|
||||
target_link_libraries(libelf::libelf INTERFACE PkgConfig::ELF)
|
||||
else()
|
||||
target_link_libraries(libelf::libelf INTERFACE ${libelf_LIBRARY})
|
||||
target_include_directories(libelf::libelf SYSTEM INTERFACE ${libelf_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(libelf_INCLUDE_DIR libelf_LIBRARY)
|
||||
@@ -0,0 +1,90 @@
|
||||
################################################################################
|
||||
# Copyright (c) 2024 - 2025 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
# find rocDecode - library and headers
|
||||
find_path(
|
||||
rocDecode_ROOT_DIR
|
||||
NAMES include/rocdecode
|
||||
HINTS ${ROCM_PATH}
|
||||
PATHS ${ROCM_PATH})
|
||||
|
||||
mark_as_advanced(rocDecode_ROOT_DIR)
|
||||
|
||||
find_path(
|
||||
rocDecode_INCLUDE_DIR
|
||||
NAMES rocdecode/rocdecode.h
|
||||
HINTS ${rocDecode_ROOT_DIR}
|
||||
PATHS ${rocDecode_ROOT_DIR}
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
find_library(
|
||||
rocDecode_LIBRARY
|
||||
NAMES rocdecode
|
||||
HINTS ${rocDecode_ROOT_DIR}
|
||||
PATHS ${rocDecode_ROOT_DIR}
|
||||
PATH_SUFFIXES lib)
|
||||
|
||||
function(_rocdecode_read_version_header _VERSION_VAR)
|
||||
if(rocDecode_INCLUDE_DIR AND EXISTS
|
||||
"${rocDecode_INCLUDE_DIR}/rocdecode/rocdecode_version.h")
|
||||
file(READ "${rocDecode_INCLUDE_DIR}/rocdecode/rocdecode_version.h"
|
||||
_rocdecode_version)
|
||||
macro(_rocdecode_get_version_num _VAR _NAME)
|
||||
string(REGEX MATCH "define([ \t]+)${_NAME}([ \t]+)([0-9]+)" _tmp
|
||||
"${_rocdecode_version}")
|
||||
set(${_VAR} 0)
|
||||
if(_tmp MATCHES "([0-9]+)")
|
||||
string(REGEX REPLACE "(.*${_NAME}[ ]+)([0-9]+)" "\\2" ${_VAR} "${_tmp}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_rocdecode_get_version_num(_major "ROCDECODE_MAJOR_VERSION")
|
||||
_rocdecode_get_version_num(_minor "ROCDECODE_MINOR_VERSION")
|
||||
_rocdecode_get_version_num(_patch "ROCDECODE_PATCH_VERSION")
|
||||
set(${_VERSION_VAR}
|
||||
${_major}.${_minor}.${_patch}
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
_rocdecode_read_version_header(rocDecode_VERSION)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
rocDecode
|
||||
FOUND_VAR rocDecode_FOUND
|
||||
VERSION_VAR rocDecode_VERSION
|
||||
REQUIRED_VARS rocDecode_INCLUDE_DIR rocDecode_LIBRARY)
|
||||
|
||||
if(rocDecode_FOUND)
|
||||
if(NOT TARGET rocDecode::rocDecode)
|
||||
add_library(rocDecode::rocDecode INTERFACE IMPORTED)
|
||||
target_link_libraries(rocDecode::rocDecode INTERFACE ${rocDecode_LIBRARY})
|
||||
target_include_directories(rocDecode::rocDecode
|
||||
INTERFACE ${rocDecode_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(rocDecode_INCLUDE_DIR rocDecode_LIBRARY)
|
||||
@@ -0,0 +1,87 @@
|
||||
################################################################################
|
||||
# Copyright (c) 2024 - 2025 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
# find rocJPEG - library and headers
|
||||
find_path(
|
||||
rocJPEG_ROOT_DIR
|
||||
NAMES include/rocjpeg
|
||||
HINTS ${ROCM_PATH}
|
||||
PATHS ${ROCM_PATH})
|
||||
|
||||
mark_as_advanced(rocJPEG_ROOT_DIR)
|
||||
|
||||
find_path(
|
||||
rocJPEG_INCLUDE_DIR
|
||||
NAMES rocjpeg/rocjpeg.h
|
||||
HINTS ${rocJPEG_ROOT_DIR}
|
||||
PATHS ${rocJPEG_ROOT_DIR}
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
find_library(
|
||||
rocJPEG_LIBRARY
|
||||
NAMES rocjpeg
|
||||
HINTS ${rocJPEG_ROOT_DIR}
|
||||
PATHS ${rocJPEG_ROOT_DIR}
|
||||
PATH_SUFFIXES lib)
|
||||
|
||||
function(_rocjpeg_read_version_header _VERSION_VAR)
|
||||
if(rocJPEG_INCLUDE_DIR AND EXISTS "${rocJPEG_INCLUDE_DIR}/rocjpeg/rocjpeg_version.h")
|
||||
file(READ "${rocJPEG_INCLUDE_DIR}/rocjpeg/rocjpeg_version.h" _rocjpeg_version)
|
||||
macro(_rocjpeg_get_version_num _VAR _NAME)
|
||||
string(REGEX MATCH "define([ \t]+)${_NAME}([ \t]+)([0-9]+)" _tmp
|
||||
"${_rocjpeg_version}")
|
||||
set(${_VAR} 0)
|
||||
if(_tmp MATCHES "([0-9]+)")
|
||||
string(REGEX REPLACE "(.*${_NAME}[ ]+)([0-9]+)" "\\2" ${_VAR} "${_tmp}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_rocjpeg_get_version_num(_major "ROCJPEG_MAJOR_VERSION")
|
||||
_rocjpeg_get_version_num(_minor "ROCJPEG_MINOR_VERSION")
|
||||
_rocjpeg_get_version_num(_patch "ROCJPEG_MICRO_VERSION")
|
||||
set(${_VERSION_VAR}
|
||||
${_major}.${_minor}.${_patch}
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
_rocjpeg_read_version_header(rocJPEG_VERSION)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
rocJPEG
|
||||
FOUND_VAR rocJPEG_FOUND
|
||||
VERSION_VAR rocJPEG_VERSION
|
||||
REQUIRED_VARS rocJPEG_INCLUDE_DIR rocJPEG_LIBRARY)
|
||||
|
||||
if(rocJPEG_FOUND)
|
||||
if(NOT TARGET rocJPEG::rocJPEG)
|
||||
add_library(rocJPEG::rocJPEG INTERFACE IMPORTED)
|
||||
target_link_libraries(rocJPEG::rocJPEG INTERFACE ${rocJPEG_LIBRARY})
|
||||
target_include_directories(rocJPEG::rocJPEG INTERFACE ${rocJPEG_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(rocJPEG_INCLUDE_DIR rocJPEG_LIBRARY)
|
||||
@@ -0,0 +1,302 @@
|
||||
#[=======================================================================[.rst:
|
||||
Findrocm_version
|
||||
---------------
|
||||
|
||||
Search the <ROCM_PATH>/.info/version* files to determine the version of ROCm
|
||||
|
||||
Use this module by invoking find_package with the form::
|
||||
|
||||
find_package(rocm_version
|
||||
[version] [EXACT]
|
||||
[REQUIRED])
|
||||
|
||||
This module finds the version info for ROCm. The cached variables are::
|
||||
|
||||
rocm_version_FOUND - Whether the ROCm versioning was found
|
||||
rocm_version_FULL_VERSION - The exact string from `<ROCM_PATH>/.info/version` or similar
|
||||
rocm_version_MAJOR_VERSION - Major version, e.g. 4 in 4.5.2.100-40502
|
||||
rocm_version_MINOR_VERSION - Minor version, e.g. 5 in 4.5.2.100-40502
|
||||
rocm_version_PATCH_VERSION - Patch version, e.g. 2 in 4.5.2.100-40502
|
||||
rocm_version_TWEAK_VERSION - Tweak version, e.g. 100 in 4.5.2.100-40502
|
||||
rocm_version_REVISION_VERSION - Revision version, e.g. 40502 in 4.5.2.100-40502.
|
||||
rocm_version_EPOCH_VERSION - See deb-version for a description of epochs. Epochs are used when versioning system change
|
||||
rocm_version_CANONICAL_VERSION - `[<EPOCH>:]<MAJOR>.<MINOR>.<MINOR>[.<TWEAK>][-<REVISION>]`
|
||||
rocm_version_NUMERIC_VERSION - e.g. `10000*<MAJOR> + 100*<MINOR> + <PATCH>`, e.g. 40502 for ROCm 4.5.2
|
||||
rocm_version_TRIPLE_VERSION - e.g. `<MAJOR>.<MINOR>.<PATCH>`, e.g. 4.5.2 for ROCm 4.5.2
|
||||
|
||||
These variables are relevant for the find procedure::
|
||||
|
||||
rocm_version_DEBUG - Print info about processing
|
||||
rocm_version_VERSION_FILE - `<FILE>` to read from in `<ROCM_PATH>/.info/<FILE>`, e.g. `version`, `version-dev`, `version-hip-libraries`, etc.
|
||||
It may also be a full path
|
||||
rocm_version_DIR - Root location for <ROCM_PATH>
|
||||
#]=======================================================================]
|
||||
|
||||
set(rocm_version_VARIABLES
|
||||
EPOCH
|
||||
MAJOR
|
||||
MINOR
|
||||
PATCH
|
||||
TWEAK
|
||||
REVISION
|
||||
TRIPLE
|
||||
NUMERIC
|
||||
CANONICAL
|
||||
FULL)
|
||||
|
||||
function(ROCM_VERSION_MESSAGE _TYPE)
|
||||
if(rocm_version_DEBUG)
|
||||
message(${_TYPE} "[rocm_version] ${ARGN}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# read a .info/version* file and propagate the variables to the calling scope
|
||||
function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
|
||||
|
||||
# remove any line endings
|
||||
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
|
||||
|
||||
# store the full version so it can be set later
|
||||
set(FULL_VERSION "${FULL_VERSION_STRING}")
|
||||
|
||||
# get number and remove from full version string
|
||||
string(REGEX REPLACE "([0-9]+)\:(.*)" "\\1" EPOCH_VERSION "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "([0-9]+)\:(.*)" "\\2" FULL_VERSION_STRING
|
||||
"${FULL_VERSION_STRING}")
|
||||
|
||||
if(EPOCH_VERSION STREQUAL FULL_VERSION)
|
||||
set(EPOCH_VERSION)
|
||||
endif()
|
||||
|
||||
# get number and remove from full version string
|
||||
string(REGEX REPLACE "([0-9]+)(.*)" "\\1" MAJOR_VERSION "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
|
||||
"${FULL_VERSION_STRING}")
|
||||
|
||||
# get number and remove from full version string
|
||||
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" MINOR_VERSION "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
|
||||
"${FULL_VERSION_STRING}")
|
||||
|
||||
# get number and remove from full version string
|
||||
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" PATCH_VERSION "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
|
||||
"${FULL_VERSION_STRING}")
|
||||
|
||||
if(NOT PATCH_VERSION LESS 100)
|
||||
set(PATCH_VERSION 0)
|
||||
endif()
|
||||
|
||||
# get number and remove from full version string
|
||||
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" TWEAK_VERSION "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
|
||||
"${FULL_VERSION_STRING}")
|
||||
|
||||
# get number
|
||||
string(REGEX REPLACE "-([0-9A-Za-z+~]+)" "\\1" REVISION_VERSION
|
||||
"${FULL_VERSION_STRING}")
|
||||
|
||||
set(CANONICAL_VERSION)
|
||||
set(_MAJOR_SEP ":")
|
||||
set(_MINOR_SEP ".")
|
||||
set(_PATCH_SEP ".")
|
||||
set(_TWEAK_SEP ".")
|
||||
set(_REVISION_SEP "-")
|
||||
|
||||
foreach(_V EPOCH MAJOR MINOR PATCH TWEAK REVISION)
|
||||
if(${_V}_VERSION)
|
||||
set(CANONICAL_VERSION "${CANONICAL_VERSION}${_${_V}_SEP}${${_V}_VERSION}")
|
||||
else()
|
||||
set(CANONICAL_VERSION "${CANONICAL_VERSION}${_${_V}_SEP}0")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(_MAJOR_SEP "")
|
||||
|
||||
foreach(_V MAJOR MINOR PATCH)
|
||||
if(${_V}_VERSION)
|
||||
set(TRIPLE_VERSION "${TRIPLE_VERSION}${_${_V}_SEP}${${_V}_VERSION}")
|
||||
else()
|
||||
set(TRIPLE_VERSION "${TRIPLE_VERSION}${_${_V}_SEP}0")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
math(
|
||||
EXPR
|
||||
NUMERIC_VERSION
|
||||
"(10000 * (${MAJOR_VERSION}+0)) + (100 * (${MINOR_VERSION}+0)) + (${PATCH_VERSION}+0)"
|
||||
)
|
||||
|
||||
# propagate to parent scopes
|
||||
foreach(_V ${rocm_version_VARIABLES})
|
||||
set(${_VAR_PREFIX}_${_V}_VERSION
|
||||
${${_V}_VERSION}
|
||||
PARENT_SCOPE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# this macro watches for changes in the variables and unsets the remaining cache varaible
|
||||
# when they change
|
||||
function(ROCM_VERSION_WATCH_FOR_CHANGE _var)
|
||||
set(_rocm_version_watch_var_name rocm_version_WATCH_VALUE_${_var})
|
||||
|
||||
if(DEFINED ${_rocm_version_watch_var_name})
|
||||
if("${${_var}}" STREQUAL "${${_rocm_version_watch_var_name}}")
|
||||
if(NOT "${${_var}}" STREQUAL "")
|
||||
rocm_version_message(STATUS "${_var} :: ${${_var}}")
|
||||
endif()
|
||||
|
||||
list(REMOVE_ITEM _REMAIN_VARIABLES ${_var})
|
||||
set(_REMAIN_VARIABLES
|
||||
"${_REMAIN_VARIABLES}"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
rocm_version_message(
|
||||
STATUS
|
||||
"${_var} changed :: ${${_rocm_version_watch_var_name}} --> ${${_var}}")
|
||||
|
||||
foreach(_V ${_REMAIN_VARIABLES})
|
||||
rocm_version_message(
|
||||
STATUS "${_var} changed :: Unsetting cache variable ${_V}...")
|
||||
unset(${_V} CACHE)
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
if(NOT "${${_var}}" STREQUAL "")
|
||||
rocm_version_message(STATUS "${_var} :: ${${_var}}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# store the value for the next run
|
||||
set(${_rocm_version_watch_var_name}
|
||||
"${${_var}}"
|
||||
CACHE INTERNAL "Last value of ${_var}" FORCE)
|
||||
endfunction()
|
||||
|
||||
# scope this to a function to avoid leaking local variables
|
||||
function(ROCM_VERSION_PARSE_VERSION_FILES)
|
||||
|
||||
# the list of variables set by module. when one of these changes, we need to unset the
|
||||
# cache variables after it
|
||||
set(_ALL_VARIABLES)
|
||||
|
||||
foreach(_V ${rocm_version_VARIABLES})
|
||||
list(APPEND _ALL_VARIABLES rocm_version_${_V}_VERSION)
|
||||
endforeach()
|
||||
set(_REMAIN_VARIABLES ${_ALL_VARIABLES})
|
||||
|
||||
# read a .info/version* file and propagate the variables to the calling scope
|
||||
function(ROCM_VERSION_READ_FILE _FILE _VAR_PREFIX)
|
||||
file(READ "${_FILE}" FULL_VERSION_STRING LIMIT_COUNT 1)
|
||||
rocm_version_compute("${FULL_VERSION_STRING}" "${_VAR_PREFIX}")
|
||||
|
||||
# propagate to parent scopes
|
||||
foreach(_V ${rocm_version_VARIABLES})
|
||||
set(${_VAR_PREFIX}_${_V}_VERSION
|
||||
${${_VAR_PREFIX}_${_V}_VERSION}
|
||||
PARENT_SCOPE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# search for HIP to set ROCM_PATH if(NOT hip_FOUND) find_package(hip) endif()
|
||||
|
||||
function(COMPUTE_ROCM_VERSION_DIR)
|
||||
if(EXISTS "${rocm_version_VERSION_FILE}" AND IS_ABSOLUTE
|
||||
"${rocm_version_VERSION_FILE}")
|
||||
get_filename_component(_VERSION_DIR "${rocm_version_VERSION_FILE}" PATH)
|
||||
get_filename_component(_VERSION_DIR "${_VERSION_DIR}/.." REALPATH)
|
||||
set(rocm_version_DIR
|
||||
"${_VERSION_DIR}"
|
||||
CACHE PATH "Root path to ROCm's .info/${rocm_version_VERSION_FILE}"
|
||||
${ARGN})
|
||||
rocm_version_watch_for_change(rocm_version_DIR)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(rocm_version_VERSION_FILE)
|
||||
get_filename_component(_VERSION_FILE "${rocm_version_VERSION_FILE}" NAME)
|
||||
set(_VERSION_FILES ${_VERSION_FILE})
|
||||
compute_rocm_version_dir(FORCE)
|
||||
else()
|
||||
set(_VERSION_FILES version version-dev version-hip-libraries version-hiprt
|
||||
version-hiprt-devel version-hip-sdk version-libs version-utils)
|
||||
rocm_version_message(STATUS "rocm_version version files: ${_VERSION_FILES}")
|
||||
endif()
|
||||
|
||||
# convert env to cache if not defined
|
||||
foreach(_PATH rocm_version_DIR rocm_version_ROOT rocm_version_ROOT_DIR
|
||||
ROCPROFILER_DEFAULT_ROCM_PATH ROCM_PATH)
|
||||
if(NOT DEFINED ${_PATH} AND DEFINED ENV{${_PATH}})
|
||||
set(_VAL "$ENV{${_PATH}}")
|
||||
get_filename_component(_VAL "${_VAL}" REALPATH)
|
||||
set(${_PATH}
|
||||
"${_VAL}"
|
||||
CACHE PATH "Search path for ROCm version for rocm_version")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(rocm_version_DIR)
|
||||
set(_PATHS ${rocm_version_DIR})
|
||||
else()
|
||||
set(_PATHS)
|
||||
foreach(
|
||||
_DIR
|
||||
${rocm_version_DIR} ${rocm_version_ROOT} ${rocm_version_ROOT_DIR}
|
||||
$ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${ROCPROFILER_DEFAULT_ROCM_PATH}
|
||||
${ROCM_PATH} /opt/rocm)
|
||||
if(EXISTS ${_DIR})
|
||||
get_filename_component(_ABS_DIR "${_DIR}" REALPATH)
|
||||
list(APPEND _PATHS ${_ABS_DIR})
|
||||
endif()
|
||||
endforeach()
|
||||
rocm_version_message(STATUS "rocm_version search paths: ${_PATHS}")
|
||||
endif()
|
||||
|
||||
string(REPLACE ":" ";" _PATHS "${_PATHS}")
|
||||
|
||||
foreach(_PATH ${_PATHS})
|
||||
foreach(_FILE ${_VERSION_FILES})
|
||||
set(_F ${_PATH}/.info/${_FILE})
|
||||
if(EXISTS ${_F})
|
||||
set(rocm_version_VERSION_FILE
|
||||
"${_F}"
|
||||
CACHE FILEPATH "File with versioning info")
|
||||
rocm_version_watch_for_change(rocm_version_VERSION_FILE)
|
||||
compute_rocm_version_dir()
|
||||
else()
|
||||
rocm_version_message(AUTHOR_WARNING "File does not exist: ${_F}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if(EXISTS "${rocm_version_VERSION_FILE}")
|
||||
set(_F "${rocm_version_VERSION_FILE}")
|
||||
rocm_version_message(STATUS "Reading ${_F}...")
|
||||
get_filename_component(_B "${_F}" NAME)
|
||||
string(REPLACE "." "_" _B "${_B}")
|
||||
string(REPLACE "-" "_" _B "${_B}")
|
||||
rocm_version_read_file(${_F} ${_B})
|
||||
|
||||
foreach(_V ${rocm_version_VARIABLES})
|
||||
set(_CACHE_VAR rocm_version_${_V}_VERSION)
|
||||
set(_LOCAL_VAR ${_B}_${_V}_VERSION)
|
||||
set(rocm_version_${_V}_VERSION
|
||||
"${${_LOCAL_VAR}}"
|
||||
CACHE STRING "ROCm ${_V} version")
|
||||
rocm_version_watch_for_change(${_CACHE_VAR})
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# execute
|
||||
rocm_version_parse_version_files()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
rocm_version
|
||||
VERSION_VAR rocm_version_FULL_VERSION
|
||||
REQUIRED_VARS rocm_version_FULL_VERSION rocm_version_TRIPLE_VERSION rocm_version_DIR
|
||||
rocm_version_VERSION_FILE)
|
||||
# don't add major/minor/patch/etc. version variables to required vars because they might
|
||||
# be zero, which will cause CMake to evaluate it as not set
|
||||
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# Custom compilation of source code
|
||||
#
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# this provides a function to easily select which files use alternative compiler:
|
||||
#
|
||||
# * GLOBAL --> all files
|
||||
# * TARGET --> all files in a target
|
||||
# * SOURCE --> specific source files
|
||||
# * DIRECTORY --> all files in directory
|
||||
# * PROJECT --> all files/targets in a project/subproject
|
||||
#
|
||||
function(rocprofiler_sdk_custom_compilation)
|
||||
cmake_parse_arguments(COMP "GLOBAL;PROJECT" "COMPILER" "DIRECTORY;TARGET;SOURCE"
|
||||
${ARGN})
|
||||
|
||||
# find rocprofiler-sdk-launch-compiler
|
||||
find_program(
|
||||
ROCPROFILER_SDK_COMPILE_LAUNCHER
|
||||
NAMES rocprofiler-sdk-launch-compiler
|
||||
HINTS ${rocprofiler-sdk_ROOT_DIR} ${PROJECT_BINARY_DIR} ${CMAKE_BINARY_DIR}
|
||||
PATHS ${rocprofiler-sdk_ROOT_DIR} ${PROJECT_BINARY_DIR} ${CMAKE_BINARY_DIR}
|
||||
PATH_SUFFIXES libexec/rocprofiler-sdk)
|
||||
|
||||
if(NOT COMP_COMPILER)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"rocprofiler_sdk_custom_compilation not provided COMPILER argument")
|
||||
elseif(NOT EXISTS "${COMP_COMPILER}")
|
||||
cmake_path(GET COMP_COMPILER FILENAME COMP_COMPILER_BASE)
|
||||
find_program(
|
||||
ROCPROFILER_SDK_COMPILER_${COMP_COMPILER_BASE}
|
||||
NAMES ${COMP_COMPILER_BASE}
|
||||
PATH_SUFFIXES bin REQUIRED)
|
||||
set(COMP_COMPILER ROCPROFILER_SDK_COMPILER_${COMP_COMPILER_BASE})
|
||||
endif()
|
||||
|
||||
if(NOT ROCPROFILER_SDK_COMPILE_LAUNCHER)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"rocprofiler-sdk could not find 'rocprofiler-sdk-launch-compiler'. Please set '-DROCPROFILER_SDK_COMPILE_LAUNCHER=/path/to/launcher'"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(COMP_GLOBAL)
|
||||
# if global, don't bother setting others
|
||||
set_property(
|
||||
GLOBAL
|
||||
PROPERTY
|
||||
RULE_LAUNCH_COMPILE
|
||||
"${ROCPROFILER_SDK_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
|
||||
)
|
||||
set_property(
|
||||
GLOBAL
|
||||
PROPERTY
|
||||
RULE_LAUNCH_LINK
|
||||
"${ROCPROFILER_SDK_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
|
||||
)
|
||||
else()
|
||||
foreach(_TYPE PROJECT DIRECTORY TARGET SOURCE)
|
||||
# make project/subproject scoping easy, e.g.
|
||||
# rocprofiler_sdk_custom_compilation(PROJECT) after project(...)
|
||||
if("${_TYPE}" STREQUAL "PROJECT" AND COMP_${_TYPE})
|
||||
list(APPEND COMP_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
unset(COMP_${_TYPE})
|
||||
endif()
|
||||
|
||||
# set the properties if defined
|
||||
if(COMP_${_TYPE})
|
||||
foreach(_VAL ${COMP_${_TYPE}})
|
||||
set_property(
|
||||
${_TYPE} ${_VAL}
|
||||
PROPERTY
|
||||
RULE_LAUNCH_COMPILE
|
||||
"${ROCPROFILER_SDK_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
|
||||
)
|
||||
set_property(
|
||||
${_TYPE} ${_VAL}
|
||||
PROPERTY
|
||||
RULE_LAUNCH_LINK
|
||||
"${ROCPROFILER_SDK_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,110 @@
|
||||
#
|
||||
# Miscellaneous cmake functions for rocprofiler-sdk
|
||||
#
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
function(rocprofiler_sdk_get_gfx_architectures _VAR)
|
||||
cmake_parse_arguments(ARG "ECHO" "PREFIX;DELIM" "" ${ARGN})
|
||||
|
||||
if(NOT DEFINED ARG_DELIM)
|
||||
set(ARG_DELIM ", ")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
|
||||
|
||||
find_program(
|
||||
rocminfo_EXECUTABLE
|
||||
NAMES rocminfo
|
||||
HINTS ${rocprofiler-sdk_ROOT_DIR} ${rocm_version_DIR} ${ROCM_PATH} /opt/rocm
|
||||
PATHS ${rocprofiler-sdk_ROOT_DIR} ${rocm_version_DIR} ${ROCM_PATH} /opt/rocm
|
||||
PATH_SUFFIXES bin)
|
||||
|
||||
if(rocminfo_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${rocminfo_EXECUTABLE}
|
||||
RESULT_VARIABLE rocminfo_RET
|
||||
OUTPUT_VARIABLE rocminfo_OUT
|
||||
ERROR_VARIABLE rocminfo_ERR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(rocminfo_RET EQUAL 0)
|
||||
string(REGEX MATCHALL "gfx([0-9A-Fa-f]+)" rocminfo_GFXINFO "${rocminfo_OUT}")
|
||||
list(REMOVE_DUPLICATES rocminfo_GFXINFO)
|
||||
set(${_VAR}
|
||||
"${rocminfo_GFXINFO}"
|
||||
PARENT_SCOPE)
|
||||
|
||||
if(ARG_ECHO)
|
||||
string(REPLACE ";" "${ARG_DELIM}" _GFXINFO_ECHO "${rocminfo_GFXINFO}")
|
||||
message(STATUS "${ARG_PREFIX}System architectures: ${_GFXINFO_ECHO}")
|
||||
endif()
|
||||
else()
|
||||
message(
|
||||
AUTHOR_WARNING
|
||||
"${rocminfo_EXECUTABLE} returned ${rocminfo_RET}\nstderr:\n${rocminfo_ERR}\nstdout:\n${rocminfo_OUT}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# In case the underlying architecture does not support PC sampling, this function will
|
||||
# tell us whether the PC sampling is disabled
|
||||
function(rocprofiler_sdk_pc_sampling_disabled _VAR)
|
||||
cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN})
|
||||
|
||||
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
|
||||
|
||||
rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO)
|
||||
list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info)
|
||||
|
||||
if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx90a$"
|
||||
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$"
|
||||
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx95[0-9]$")
|
||||
# PC sampling is enabled on this architecture.
|
||||
set(${_VAR}
|
||||
FALSE
|
||||
PARENT_SCOPE)
|
||||
if(ARG_ECHO)
|
||||
message(STATUS "PC Sampling is enabled for ${pc-sampling-gpu-0-gfx-info}")
|
||||
endif()
|
||||
else()
|
||||
# PC sampling is disabled on this architecture.
|
||||
set(${_VAR}
|
||||
TRUE
|
||||
PARENT_SCOPE)
|
||||
if(ARG_ECHO)
|
||||
message(STATUS "PC Sampling is disabled for ${pc-sampling-gpu-0-gfx-info}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# In case the underlying architecture does not support stochastic PC sampling, this
|
||||
# function will tell us whether the PC sampling is disabled
|
||||
function(rocprofiler_sdk_pc_sampling_stochastic_disabled _VAR)
|
||||
cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN})
|
||||
|
||||
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
|
||||
|
||||
rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO)
|
||||
list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info)
|
||||
|
||||
if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$"
|
||||
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx95[0-9]$")
|
||||
# PC sampling is enabled on this architecture.
|
||||
set(${_VAR}
|
||||
FALSE
|
||||
PARENT_SCOPE)
|
||||
if(ARG_ECHO)
|
||||
message(STATUS "PC Sampling is enabled for ${pc-sampling-gpu-0-gfx-info}")
|
||||
endif()
|
||||
else()
|
||||
# PC sampling is disabled on this architecture.
|
||||
set(${_VAR}
|
||||
TRUE
|
||||
PARENT_SCOPE)
|
||||
if(ARG_ECHO)
|
||||
message(STATUS "PC Sampling is disabled for ${pc-sampling-gpu-0-gfx-info}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,16 @@
|
||||
#%Module1.0
|
||||
|
||||
module-whatis "@PACKAGE_NAME@ (version @PROJECT_VERSION@)"
|
||||
|
||||
proc ModulesHelp { } {
|
||||
puts stderr "Loads @PACKAGE_NAME@ v@PROJECT_VERSION@"
|
||||
}
|
||||
|
||||
set ROOT [file normalize [file dirname [file normalize ${ModulesCurrentModulefile}]]/../../..]
|
||||
|
||||
setenv @PACKAGE_NAME_UNDERSCORED@_ROOT "${ROOT}"
|
||||
prepend-path CMAKE_PREFIX_PATH "${ROOT}"
|
||||
prepend-path PATH "${ROOT}/bin"
|
||||
prepend-path LD_LIBRARY_PATH "${ROOT}/@CMAKE_INSTALL_LIBDIR@"
|
||||
prepend-path PYTHONPATH "${ROOT}/@CMAKE_INSTALL_PYTHONDIR@"
|
||||
setenv @PACKAGE_NAME_UNDERSCORED@_DIR "${ROOT}/@CMAKE_INSTALL_LIBDIR@/cmake/@PACKAGE_NAME@"
|
||||
@@ -0,0 +1,9 @@
|
||||
# Config file for @PACKAGE_NAME@ and its component libraries in the build tree
|
||||
#
|
||||
|
||||
list(APPEND @PACKAGE_NAME@_INCLUDE_DIR @CMAKE_BINARY_DIR@/source/include)
|
||||
|
||||
foreach(COMP @PROJECT_BUILD_TREE_TARGETS@)
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${COMP})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${COMP})
|
||||
endforeach()
|
||||
@@ -0,0 +1,73 @@
|
||||
# - Config file for @PACKAGE_NAME@ and its component libraries
|
||||
# It defines the following variables:
|
||||
#
|
||||
# @PACKAGE_NAME@_VERSION
|
||||
# @PACKAGE_NAME@_INCLUDE_DIR
|
||||
# @PACKAGE_NAME@_LIB_DIR
|
||||
# @PACKAGE_NAME@_LIBRARIES
|
||||
#
|
||||
# It provides the following interface libraries:
|
||||
#
|
||||
# @PACKAGE_NAME@::@PACKAGE_NAME@
|
||||
#
|
||||
|
||||
# prevent "target already exists" error
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
# compute paths
|
||||
get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(@PACKAGE_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set_and_check(@PACKAGE_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
|
||||
get_filename_component(@PACKAGE_NAME@_ROOT_DIR ${@PACKAGE_NAME@_INCLUDE_DIR} PATH)
|
||||
set_and_check(@PACKAGE_NAME@_ROOT "${@PACKAGE_NAME@_ROOT_DIR}")
|
||||
|
||||
# extra validation
|
||||
foreach(_@PACKAGE_NAME@_SUBDIR @PROJECT_EXTRA_DIRS@)
|
||||
set_and_check(_@PACKAGE_NAME@_SUBDIR_CHECK
|
||||
"${PACKAGE_PREFIX_DIR}/${_@PACKAGE_NAME@_SUBDIR}")
|
||||
unset(_@PACKAGE_NAME@_SUBDIR_CHECK)
|
||||
endforeach()
|
||||
|
||||
set(@PACKAGE_NAME@_LIBRARIES)
|
||||
|
||||
# add interface library
|
||||
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE IMPORTED)
|
||||
|
||||
if(@PACKAGE_NAME@_BUILD_TREE
|
||||
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake")
|
||||
else()
|
||||
include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-targets.cmake")
|
||||
|
||||
# Library dependencies
|
||||
if(@PACKAGE_NAME@_FIND_COMPONENTS)
|
||||
foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS})
|
||||
set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${COMP})
|
||||
if(TARGET ${TARG})
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
else()
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 0)
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
foreach(TARG @PROJECT_BUILD_TARGETS@)
|
||||
set(TARG @PACKAGE_NAME@::${TARG})
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@PACKAGE_NAME@
|
||||
FOUND_VAR @PACKAGE_NAME@_FOUND
|
||||
VERSION_VAR @PACKAGE_NAME@_VERSION
|
||||
REQUIRED_VARS @PACKAGE_NAME@_ROOT_DIR @PACKAGE_NAME@_INCLUDE_DIR
|
||||
@PACKAGE_NAME@_LIB_DIR @PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_VERSION
|
||||
HANDLE_COMPONENTS HANDLE_VERSION_RANGE)
|
||||
@@ -0,0 +1,9 @@
|
||||
# Config file for @PACKAGE_NAME@ and its component libraries in the build tree
|
||||
#
|
||||
|
||||
list(APPEND @PACKAGE_NAME@_INCLUDE_DIR @CMAKE_BINARY_DIR@/source/include)
|
||||
|
||||
foreach(COMP @PROJECT_BUILD_TREE_TARGETS@)
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${COMP})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${COMP})
|
||||
endforeach()
|
||||
@@ -0,0 +1,73 @@
|
||||
# - Config file for @PACKAGE_NAME@ and its component libraries
|
||||
# It defines the following variables:
|
||||
#
|
||||
# @PACKAGE_NAME@_VERSION
|
||||
# @PACKAGE_NAME@_INCLUDE_DIR
|
||||
# @PACKAGE_NAME@_LIB_DIR
|
||||
# @PACKAGE_NAME@_LIBRARIES
|
||||
#
|
||||
# It provides the following interface libraries:
|
||||
#
|
||||
# @PACKAGE_NAME@::@PACKAGE_NAME@
|
||||
#
|
||||
|
||||
# prevent "target already exists" error
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
# compute paths
|
||||
get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(@PACKAGE_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set_and_check(@PACKAGE_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
|
||||
get_filename_component(@PACKAGE_NAME@_ROOT_DIR ${@PACKAGE_NAME@_INCLUDE_DIR} PATH)
|
||||
set_and_check(@PACKAGE_NAME@_ROOT "${@PACKAGE_NAME@_ROOT_DIR}")
|
||||
|
||||
# extra validation
|
||||
foreach(_@PACKAGE_NAME@_SUBDIR @PROJECT_EXTRA_DIRS@)
|
||||
set_and_check(_@PACKAGE_NAME@_SUBDIR_CHECK
|
||||
"${PACKAGE_PREFIX_DIR}/${_@PACKAGE_NAME@_SUBDIR}")
|
||||
unset(_@PACKAGE_NAME@_SUBDIR_CHECK)
|
||||
endforeach()
|
||||
|
||||
set(@PACKAGE_NAME@_LIBRARIES)
|
||||
|
||||
# add interface library
|
||||
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE IMPORTED)
|
||||
|
||||
if(@PACKAGE_NAME@_BUILD_TREE
|
||||
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake")
|
||||
else()
|
||||
include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-targets.cmake")
|
||||
|
||||
# Library dependencies
|
||||
if(@PACKAGE_NAME@_FIND_COMPONENTS)
|
||||
foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS})
|
||||
set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${COMP})
|
||||
if(TARGET ${TARG})
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
else()
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 0)
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
foreach(TARG @PROJECT_BUILD_TARGETS@)
|
||||
set(TARG @PACKAGE_NAME@::${TARG})
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@PACKAGE_NAME@
|
||||
FOUND_VAR @PACKAGE_NAME@_FOUND
|
||||
VERSION_VAR @PACKAGE_NAME@_VERSION
|
||||
REQUIRED_VARS @PACKAGE_NAME@_ROOT_DIR @PACKAGE_NAME@_INCLUDE_DIR
|
||||
@PACKAGE_NAME@_LIB_DIR @PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_VERSION
|
||||
HANDLE_COMPONENTS HANDLE_VERSION_RANGE)
|
||||
@@ -0,0 +1,25 @@
|
||||
# Config file for @PROJECT_NAME@ and its component libraries in the build tree
|
||||
#
|
||||
|
||||
if(@PACKAGE_NAME@_FIND_COMPONENTS)
|
||||
foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS})
|
||||
set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${COMP})
|
||||
if(TARGET ${TARG})
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
else()
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 0)
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(@PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@::@PACKAGE_NAME@)
|
||||
endif()
|
||||
|
||||
foreach(COMP @PROJECT_BUILD_TREE_TARGETS@)
|
||||
set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${COMP})
|
||||
if(TARGET ${TARG})
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -0,0 +1,178 @@
|
||||
# - Config file for @PACKAGE_NAME@ and its component libraries
|
||||
# It defines the following variables:
|
||||
#
|
||||
# @PACKAGE_NAME@_VERSION
|
||||
# @PACKAGE_NAME@_INCLUDE_DIR
|
||||
# @PACKAGE_NAME@_LIB_DIR
|
||||
# @PACKAGE_NAME@_LIBRARIES
|
||||
#
|
||||
# It provides the following interface libraries:
|
||||
#
|
||||
# @PROJECT_NAME@::@PROJECT_NAME@
|
||||
# @PACKAGE_NAME@::@PACKAGE_NAME@
|
||||
#
|
||||
|
||||
# prevent "target already exists" error
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
# compute paths
|
||||
get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(@PACKAGE_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set_and_check(@PACKAGE_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
|
||||
get_filename_component(@PACKAGE_NAME@_ROOT_DIR ${@PACKAGE_NAME@_INCLUDE_DIR} PATH)
|
||||
|
||||
# extra validation
|
||||
foreach(_@PACKAGE_NAME@_SUBDIR @PROJECT_EXTRA_DIRS@)
|
||||
set_and_check(_@PACKAGE_NAME@_SUBDIR_CHECK
|
||||
"${PACKAGE_PREFIX_DIR}/${_@PACKAGE_NAME@_SUBDIR}")
|
||||
unset(_@PACKAGE_NAME@_SUBDIR_CHECK)
|
||||
endforeach()
|
||||
|
||||
set(@PACKAGE_NAME@_LIBRARIES)
|
||||
|
||||
# add interface library
|
||||
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(@PACKAGE_NAME@::@PACKAGE_NAME@
|
||||
INTERFACE "${@PACKAGE_NAME@_INCLUDE_DIR}")
|
||||
target_link_directories(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE
|
||||
"${@PACKAGE_NAME@_LIB_DIR}")
|
||||
|
||||
if(@PACKAGE_NAME@_BUILD_TREE
|
||||
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake")
|
||||
else()
|
||||
find_package(
|
||||
AMDDeviceLibs
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@AMDDeviceLibs_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@AMDDeviceLibs_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
find_package(
|
||||
amd_comgr
|
||||
@PACKAGE_amd_comgr_VERSION@
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@amd_comgr_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@amd_comgr_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
find_package(
|
||||
hsa-runtime64
|
||||
@PACKAGE_hsa-runtime64_VERSION@
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@hsa-runtime64_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@hsa-runtime64_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
find_package(
|
||||
hip
|
||||
@PACKAGE_hip_VERSION@
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@hip_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@hip_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-config-nolink-target.cmake")
|
||||
|
||||
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink INTERFACE IMPORTED)
|
||||
|
||||
# if rccl not found or <rccl/amd_detail/api_trace.h> not found when rocprofiler-sdk
|
||||
# was built, use the packaged rccl.h and api_trace.h
|
||||
if(NOT @rccl_FOUND@ OR NOT @rccl_API_TRACE_FOUND@)
|
||||
target_compile_definitions(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink
|
||||
INTERFACE ROCPROFILER_SDK_USE_SYSTEM_RCCL=0)
|
||||
endif()
|
||||
|
||||
include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-targets.cmake")
|
||||
|
||||
rocprofiler_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink hip::host)
|
||||
rocprofiler_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink hsa-runtime64::hsa-runtime64)
|
||||
rocprofiler_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink amd_comgr)
|
||||
|
||||
# Library dependencies
|
||||
if(@PACKAGE_NAME@_FIND_COMPONENTS)
|
||||
foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS})
|
||||
set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${COMP})
|
||||
if(TARGET ${TARG})
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
else()
|
||||
set(@PACKAGE_NAME@_${COMP}_FOUND 0)
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
foreach(TARG @PROJECT_BUILD_TARGETS@)
|
||||
set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${TARG})
|
||||
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(EXISTS ${@PACKAGE_NAME@_CMAKE_DIR}/Modules)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 ${@PACKAGE_NAME@_CMAKE_DIR}/Modules)
|
||||
find_package(libdw)
|
||||
list(REMOVE_AT CMAKE_MODULE_PATH 0)
|
||||
endif()
|
||||
|
||||
if(libdw_FOUND AND TARGET libdw::libdw)
|
||||
rocprofiler_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink
|
||||
libdw::libdw)
|
||||
endif()
|
||||
|
||||
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@
|
||||
INTERFACE @PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink)
|
||||
endif()
|
||||
|
||||
add_executable(@PACKAGE_NAME@::rocprofv3 IMPORTED)
|
||||
set_property(
|
||||
TARGET @PACKAGE_NAME@::rocprofv3
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
${@PACKAGE_NAME@_ROOT_DIR}/@CMAKE_INSTALL_BINDIR@/rocprofv3)
|
||||
|
||||
add_executable(@PACKAGE_NAME@::rocprofv3-avail IMPORTED)
|
||||
set_property(
|
||||
TARGET @PACKAGE_NAME@::rocprofv3-avail
|
||||
PROPERTY IMPORTED_LOCATION ${@PACKAGE_NAME@_ROOT_DIR}/@CMAKE_INSTALL_BINDIR@/rocprofv3-avail)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@PACKAGE_NAME@
|
||||
FOUND_VAR @PACKAGE_NAME@_FOUND
|
||||
VERSION_VAR @PACKAGE_NAME@_VERSION
|
||||
REQUIRED_VARS @PACKAGE_NAME@_ROOT_DIR @PACKAGE_NAME@_INCLUDE_DIR
|
||||
@PACKAGE_NAME@_LIB_DIR @PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_VERSION
|
||||
HANDLE_COMPONENTS HANDLE_VERSION_RANGE)
|
||||
|
||||
if(EXISTS ${@PACKAGE_NAME@_CMAKE_DIR}/Modules)
|
||||
list(APPEND CMAKE_MODULE_PATH ${@PACKAGE_NAME@_CMAKE_DIR}/Modules)
|
||||
include(rocprofiler-sdk-utilities)
|
||||
endif()
|
||||
|
||||
add_executable(@PACKAGE_NAME@::convert-counters-collection-format IMPORTED)
|
||||
set_property(
|
||||
TARGET @PACKAGE_NAME@::convert-counters-collection-format
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION
|
||||
${@PACKAGE_NAME@_ROOT_DIR}/share/@PACKAGE_NAME@/convert-counters-collection-format.py
|
||||
)
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
BASEDIR=$(dirname ${BASH_SOURCE[0]})
|
||||
command -v realpath &> /dev/null && BASEDIR=$(realpath ${BASEDIR}/../..) || BASEDIR=$(cd ${BASEDIR}/../.. && pwd)
|
||||
|
||||
if [ ! -d "${BASEDIR}" ]; then
|
||||
echo "${BASEDIR} does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@PACKAGE_NAME_UNDERSCORED@_get_python3_path()
|
||||
{
|
||||
local PYTHON3_EXECUTABLE=$(command -v python3 2> /dev/null)
|
||||
if [ -n "${PYTHON3_EXECUTABLE}" ]; then
|
||||
local PYTHON3_VERSION=$(${PYTHON3_EXECUTABLE} -c "import sys; print(f'{sys.version_info[0]}.{sys.version_info[1]}')" 2> /dev/null)
|
||||
local @PACKAGE_NAME_UNDERSCORED@_PYTHONPATH=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/python${PYTHON3_VERSION}/site-packages
|
||||
if [ -d "${@PACKAGE_NAME_UNDERSCORED@_PYTHONPATH}" ]; then
|
||||
echo ${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/python${PYTHON3_VERSION}/site-packages
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@PACKAGE_NAME_UNDERSCORED@_ROOT=${BASEDIR}
|
||||
@PACKAGE_NAME_UNDERSCORED@_DIR=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/cmake/@PACKAGE_NAME@
|
||||
PATH=${BASEDIR}/bin:${PATH}
|
||||
LD_LIBRARY_PATH=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@:${LD_LIBRARY_PATH}
|
||||
CMAKE_PREFIX_PATH=${BASEDIR}:${CMAKE_PREFIX_PATH}
|
||||
|
||||
if [ -z "@CMAKE_INSTALL_PYTHONDIR@" ]; then
|
||||
PYTHONPATH=$(@PACKAGE_NAME_UNDERSCORED@_get_python3_path):${PYTHONPATH}
|
||||
else
|
||||
PYTHONPATH=${BASEDIR}/@CMAKE_INSTALL_PYTHONDIR@:${PYTHONPATH}
|
||||
fi
|
||||
|
||||
unset @PACKAGE_NAME_UNDERSCORED@_get_python3_path
|
||||
|
||||
export @PACKAGE_NAME_UNDERSCORED@_ROOT
|
||||
export @PACKAGE_NAME_UNDERSCORED@_DIR
|
||||
export PATH
|
||||
export LD_LIBRARY_PATH
|
||||
export CMAKE_PREFIX_PATH
|
||||
export PYTHONPATH
|
||||
@@ -0,0 +1,239 @@
|
||||
# ########################################################################################
|
||||
#
|
||||
# Handles the build settings
|
||||
#
|
||||
# ########################################################################################
|
||||
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(rocprofiler_compilers)
|
||||
include(rocprofiler_utilities)
|
||||
|
||||
target_compile_definitions(rocprofiler-sdk-build-flags INTERFACE $<$<CONFIG:DEBUG>:DEBUG>)
|
||||
|
||||
if(ROCPROFILER_BUILD_CI)
|
||||
rocprofiler_target_compile_definitions(rocprofiler-sdk-build-flags
|
||||
INTERFACE ROCPROFILER_CI)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_CODECOV)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags INTERFACE gcov)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# dynamic linking and runtime libraries
|
||||
#
|
||||
if(CMAKE_DL_LIBS AND NOT "${CMAKE_DL_LIBS}" STREQUAL "dl")
|
||||
# if cmake provides dl library, use that
|
||||
set(dl_LIBRARY
|
||||
${CMAKE_DL_LIBS}
|
||||
CACHE FILEPATH "dynamic linking system library")
|
||||
endif()
|
||||
|
||||
foreach(_TYPE dl rt)
|
||||
if(NOT ${_TYPE}_LIBRARY)
|
||||
find_library(${_TYPE}_LIBRARY NAMES ${_TYPE})
|
||||
find_package_handle_standard_args(${_TYPE}-library REQUIRED_VARS ${_TYPE}_LIBRARY)
|
||||
if(${_TYPE}-library_FOUND)
|
||||
string(TOUPPER "${_TYPE}" _TYPE_UC)
|
||||
rocprofiler_target_compile_definitions(rocprofiler-sdk-${_TYPE}
|
||||
INTERFACE ROCPROFILER_${_TYPE_UC}=1)
|
||||
target_link_libraries(rocprofiler-sdk-${_TYPE} INTERFACE ${${_TYPE}_LIBRARY})
|
||||
if("${_TYPE}" STREQUAL "dl" AND NOT ROCPROFILER_ENABLE_CLANG_TIDY)
|
||||
# This instructs the linker to add all symbols, not only used ones, to the
|
||||
# dynamic symbol table. This option is needed for some uses of dlopen or
|
||||
# to allow obtaining backtraces from within a program.
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-${_TYPE}
|
||||
LANGUAGES C CXX
|
||||
LINK_LANGUAGES C CXX
|
||||
INTERFACE "-rdynamic")
|
||||
endif()
|
||||
else()
|
||||
rocprofiler_target_compile_definitions(rocprofiler-sdk-${_TYPE}
|
||||
INTERFACE ROCPROFILER_${_TYPE_UC}=0)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-dl)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# set the compiler flags
|
||||
#
|
||||
rocprofiler_target_compile_options(rocprofiler-sdk-build-flags
|
||||
INTERFACE "-W" "-Wall" "-Wno-unknown-pragmas")
|
||||
|
||||
# compiler version specific flags
|
||||
function(set_compiler_options compiler_id version)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL ${compiler_id} AND CMAKE_CXX_COMPILER_VERSION
|
||||
VERSION_LESS_EQUAL ${version})
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-build-flags
|
||||
INTERFACE "-Wno-error=extra" "-Wno-unused-variable"
|
||||
"-Wno-error=unused-but-set-variable"
|
||||
"-Wno-error=unused-but-set-parameter" "-Wno-error=shadow")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Check GCC version
|
||||
set_compiler_options("GNU" "8.5")
|
||||
|
||||
# Check Clang version
|
||||
set_compiler_options("Clang" "13.0")
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# extra flags for debug information in debug or optimized binaries
|
||||
#
|
||||
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-debug-flags INTERFACE "-g3" "-fno-omit-frame-pointer"
|
||||
"-fno-optimize-sibling-calls")
|
||||
|
||||
target_compile_options(
|
||||
rocprofiler-sdk-debug-flags
|
||||
INTERFACE $<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-rdynamic>>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-rdynamic>>)
|
||||
|
||||
if(NOT APPLE AND NOT ROCPROFILER_ENABLE_CLANG_TIDY)
|
||||
target_link_options(rocprofiler-sdk-debug-flags INTERFACE
|
||||
$<$<CXX_COMPILER_ID:GNU>:-rdynamic>)
|
||||
endif()
|
||||
|
||||
if(dl_LIBRARY)
|
||||
target_link_libraries(rocprofiler-sdk-debug-flags INTERFACE ${dl_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(rt_LIBRARY)
|
||||
target_link_libraries(rocprofiler-sdk-debug-flags INTERFACE ${rt_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_DEBUG)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-debug-flags)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# debug-safe optimizations
|
||||
#
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-build-flags
|
||||
LANGUAGES CXX
|
||||
INTERFACE "-faligned-new")
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# fstack-protector
|
||||
#
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-stack-protector
|
||||
LANGUAGES C CXX
|
||||
INTERFACE "-fstack-protector-strong" "-Wstack-protector")
|
||||
|
||||
if(ROCPROFILER_BUILD_STACK_PROTECTOR)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-stack-protector)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# developer build flags
|
||||
#
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-developer-flags
|
||||
LANGUAGES C CXX
|
||||
INTERFACE "-Werror" "-Wdouble-promotion" "-Wshadow" "-Wextra" "-Wvla")
|
||||
|
||||
if(ROCPROFILER_BUILD_DEVELOPER)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-developer-flags)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# release build flags
|
||||
#
|
||||
rocprofiler_target_compile_options(
|
||||
rocprofiler-sdk-release-flags
|
||||
LANGUAGES C CXX
|
||||
INTERFACE "-g1" "-feliminate-unused-debug-symbols" "-gno-column-info"
|
||||
"-gno-variable-location-views" "-gline-tables-only")
|
||||
|
||||
if(ROCPROFILER_BUILD_RELEASE)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-release-flags)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# static lib flags
|
||||
#
|
||||
target_compile_options(
|
||||
rocprofiler-sdk-static-libgcc
|
||||
INTERFACE $<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-static-libgcc>>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-static-libgcc>>)
|
||||
target_link_options(
|
||||
rocprofiler-sdk-static-libgcc INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU,Clang>:-static-libgcc>>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang>:-static-libgcc>>)
|
||||
|
||||
target_compile_options(
|
||||
rocprofiler-sdk-static-libstdcxx
|
||||
INTERFACE $<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-static-libstdc++>>)
|
||||
target_link_options(
|
||||
rocprofiler-sdk-static-libstdcxx INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang>:-static-libstdc++>>)
|
||||
|
||||
if(ROCPROFILER_BUILD_STATIC_LIBGCC)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-static-libgcc)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_STATIC_LIBSTDCXX)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-static-libstdcxx)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_UNSAFE_NO_VERSION_CHECK)
|
||||
rocprofiler_target_compile_definitions(rocprofiler-sdk-build-flags
|
||||
INTERFACE ROCPROFILER_UNSAFE_NO_VERSION_CHECK)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_CI_STRICT_TIMESTAMPS)
|
||||
rocprofiler_target_compile_definitions(rocprofiler-sdk-build-flags
|
||||
INTERFACE ROCPROFILER_CI_STRICT_TIMESTAMPS)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# extra flags for compiling with experimental warnings
|
||||
#
|
||||
target_compile_definitions(rocprofiler-sdk-experimental-flags
|
||||
INTERFACE ROCPROFILER_SDK_EXPERIMENTAL_WARNINGS=1)
|
||||
rocprofiler_target_compile_options(rocprofiler-sdk-experimental-flags
|
||||
INTERFACE "-Wno-deprecated-declarations")
|
||||
|
||||
if(ROCPROFILER_BUILD_EXPERIMENTAL_WARNINGS)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-experimental-flags)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# extra flags for compiling with deprecated warnings
|
||||
#
|
||||
target_compile_definitions(rocprofiler-sdk-deprecated-flags
|
||||
INTERFACE ROCPROFILER_SDK_DEPRECATED_WARNINGS=1)
|
||||
rocprofiler_target_compile_options(rocprofiler-sdk-deprecated-flags
|
||||
INTERFACE "-Wdeprecated-declarations")
|
||||
|
||||
if(ROCPROFILER_BUILD_DEPRECATED_WARNINGS)
|
||||
target_link_libraries(rocprofiler-sdk-build-flags
|
||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-deprecated-flags)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# user customization
|
||||
#
|
||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
|
||||
if(NOT APPLE OR "$ENV{CONDA_PYTHON_EXE}" STREQUAL "")
|
||||
rocprofiler_target_user_flags(rocprofiler-sdk-build-flags "CXX")
|
||||
endif()
|
||||
@@ -0,0 +1,350 @@
|
||||
# include guard
|
||||
# ########################################################################################
|
||||
#
|
||||
# Compilers
|
||||
#
|
||||
# ########################################################################################
|
||||
#
|
||||
# sets (cached):
|
||||
#
|
||||
# CMAKE_C_COMPILER_IS_<TYPE> CMAKE_CXX_COMPILER_IS_<TYPE>
|
||||
#
|
||||
# where TYPE is: - GNU - CLANG - INTEL - INTEL_ICC - INTEL_ICPC - PGI - XLC - HP_ACC -
|
||||
# MIPS - MSVC
|
||||
#
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCSourceRuns)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckCXXSourceRuns)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
include(rocprofiler_utilities)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# macro converting string to list
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
macro(ROCPROFILER_TO_LIST _VAR _STR)
|
||||
string(REPLACE " " " " ${_VAR} "${_STR}")
|
||||
string(REPLACE " " ";" ${_VAR} "${_STR}")
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# macro converting string to list
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
macro(ROCPROFILER_TO_STRING _VAR _STR)
|
||||
string(REPLACE ";" " " ${_VAR} "${_STR}")
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# Macro to add to string
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
macro(add _VAR _FLAG)
|
||||
if(NOT "${_FLAG}" STREQUAL "")
|
||||
if("${${_VAR}}" STREQUAL "")
|
||||
set(${_VAR} "${_FLAG}")
|
||||
else()
|
||||
set(${_VAR} "${${_VAR}} ${_FLAG}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# call before running check_{c,cxx}_compiler_flag
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
macro(ROCPROFILER_BEGIN_FLAG_CHECK)
|
||||
if(ROCPROFILER_QUIET_CONFIG)
|
||||
if(NOT DEFINED CMAKE_REQUIRED_QUIET)
|
||||
set(CMAKE_REQUIRED_QUIET OFF)
|
||||
endif()
|
||||
rocprofiler_save_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET)
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# call after running check_{c,cxx}_compiler_flag
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
macro(ROCPROFILER_END_FLAG_CHECK)
|
||||
if(ROCPROFILER_QUIET_CONFIG)
|
||||
rocprofiler_restore_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# check flag
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
function(ROCPROFILER_TARGET_COMPILE_OPTIONS _TARG_TARGET)
|
||||
cmake_parse_arguments(_TARG "BUILD_INTERFACE;FORCE" ""
|
||||
"PUBLIC;INTERFACE;PRIVATE;LANGUAGES;LINK_LANGUAGES" ${ARGN})
|
||||
|
||||
if(NOT _TARG_MODE)
|
||||
set(_TARG_MODE INTERFACE)
|
||||
endif()
|
||||
|
||||
get_property(_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
set(_SUPPORTED_LANGUAGES "C" "CXX")
|
||||
|
||||
if(NOT _TARG_LANGUAGES)
|
||||
foreach(_LANG ${_ENABLED_LANGUAGES})
|
||||
if(_LANG IN_LIST _SUPPORTED_LANGUAGES)
|
||||
list(APPEND _TARG_LANGUAGES ${_LANG})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
string(TOLOWER "_${_TARG_TARGET}" _TARG_TARGET_LC)
|
||||
|
||||
function(rocprofiler_target_compile_option_impl _TARGET_IMPL _TARGET_MODE_IMPL
|
||||
_TARGET_LANG_IMPL _TARGET_FLAG_IMPL)
|
||||
if(_TARG_BUILD_INTERFACE)
|
||||
target_compile_options(
|
||||
${_TARGET_IMPL}
|
||||
${_TARGET_MODE_IMPL}
|
||||
$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:${_TARGET_LANG_IMPL}>:${_TARGET_FLAG_IMPL}>>
|
||||
)
|
||||
else()
|
||||
target_compile_options(
|
||||
${_TARGET_IMPL} ${_TARGET_MODE_IMPL}
|
||||
$<$<COMPILE_LANGUAGE:${_TARGET_LANG_IMPL}>:${_TARGET_FLAG_IMPL}>)
|
||||
endif()
|
||||
|
||||
if("${_TARGET_LANG_IMPL}" IN_LIST _TARG_LINK_LANGUAGES)
|
||||
if(_TARG_BUILD_INTERFACE)
|
||||
target_link_options(
|
||||
${_TARGET_IMPL}
|
||||
${_TARGET_MODE_IMPL}
|
||||
$<BUILD_INTERFACE:$<$<LINK_LANGUAGE:${_TARGET_LANG_IMPL}>:${_TARGET_FLAG_IMPL}>>
|
||||
)
|
||||
else()
|
||||
target_link_options(
|
||||
${_TARGET_IMPL} ${_TARGET_MODE_IMPL}
|
||||
$<$<LINK_LANGUAGE:${_TARGET_LANG_IMPL}>:${_TARGET_FLAG_IMPL}>)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(rocprofiler_target_compile_option_patch_name _P_LANG _P_IN _P_OUT)
|
||||
string(TOLOWER "${_P_LANG}" _P_LANG)
|
||||
string(REGEX REPLACE "^(/|-)" "${_P_LANG}${_TARG_TARGET_LC}_" _NAME "${_P_IN}")
|
||||
string(REPLACE "-" "_" _NAME "${_NAME}")
|
||||
string(REPLACE " " "_" _NAME "${_NAME}")
|
||||
string(REPLACE "=" "_" _NAME "${_NAME}")
|
||||
set(${_P_OUT}
|
||||
"${_NAME}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(NOT DEFINED rocprofiler_c_error AND NOT DEFINED rocprofiler_cxx_error)
|
||||
rocprofiler_begin_flag_check()
|
||||
check_c_compiler_flag("-Werror" c_rocprofiler_werror)
|
||||
check_cxx_compiler_flag("-Werror" cxx_rocprofiler_werror)
|
||||
rocprofiler_end_flag_check()
|
||||
endif()
|
||||
|
||||
foreach(_TARG_MODE PUBLIC INTERFACE PRIVATE)
|
||||
foreach(_FLAG ${_TARG_${_TARG_MODE}})
|
||||
foreach(_LANG ${_TARG_LANGUAGES})
|
||||
unset(FLAG_NAME)
|
||||
rocprofiler_target_compile_option_patch_name(${_LANG} "${_FLAG}"
|
||||
FLAG_NAME)
|
||||
|
||||
if(_TARG_FORCE)
|
||||
set(${FLAG_NAME}
|
||||
1
|
||||
CACHE INTERNAL "${_LANG} flag: ${_FLAG}")
|
||||
else()
|
||||
rocprofiler_begin_flag_check()
|
||||
|
||||
if("${_LANG}" STREQUAL "C")
|
||||
if(c_rocprofiler_werror)
|
||||
check_c_compiler_flag("${_FLAG} -Werror" ${FLAG_NAME})
|
||||
else()
|
||||
check_c_compiler_flag("${_FLAG}" ${FLAG_NAME})
|
||||
endif()
|
||||
elseif("${_LANG}" STREQUAL "CXX")
|
||||
if(cxx_rocprofiler_werror)
|
||||
check_cxx_compiler_flag("${_FLAG} -Werror" ${FLAG_NAME})
|
||||
else()
|
||||
check_cxx_compiler_flag("${_FLAG}" ${FLAG_NAME})
|
||||
endif()
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"rocprofiler_target_compile_option :: unknown language: ${_LANG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
rocprofiler_end_flag_check()
|
||||
endif()
|
||||
|
||||
if(${FLAG_NAME})
|
||||
rocprofiler_target_compile_option_impl(${_TARG_TARGET} ${_TARG_MODE}
|
||||
${_LANG} "${_FLAG}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# add to any language
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
function(ROCPROFILER_TARGET_USER_FLAGS _TARGET _LANGUAGE)
|
||||
|
||||
set(_FLAGS ${${_LANGUAGE}FLAGS} $ENV{${_LANGUAGE}FLAGS} ${${_LANGUAGE}_FLAGS}
|
||||
$ENV{${_LANGUAGE}_FLAGS})
|
||||
|
||||
string(REPLACE " " ";" _FLAGS "${_FLAGS}")
|
||||
|
||||
set(${PROJECT_NAME}_${_LANGUAGE}_FLAGS
|
||||
${${PROJECT_NAME}_${_LANGUAGE}_FLAGS} ${_FLAGS}
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS
|
||||
${${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS} ${_FLAGS}
|
||||
PARENT_SCOPE)
|
||||
|
||||
target_compile_options(${_TARGET}
|
||||
INTERFACE $<$<COMPILE_LANGUAGE:${_LANGUAGE}>:${_FLAGS}>)
|
||||
endfunction()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# add compiler definition
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
function(ROCPROFILER_TARGET_COMPILE_DEFINITIONS _TARG _VIS)
|
||||
foreach(_DEF ${ARGN})
|
||||
if(NOT "${_DEF}" MATCHES "[A-Za-z_]+=.*" AND "${_DEF}" MATCHES "^ROCPROFILER_")
|
||||
set(_DEF "${_DEF}=1")
|
||||
endif()
|
||||
target_compile_definitions(${_TARG} ${_VIS} $<$<COMPILE_LANGUAGE:CXX>:${_DEF}>)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# determine compiler types for each language
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach(LANG C CXX HIP CUDA)
|
||||
|
||||
if(NOT DEFINED CMAKE_${LANG}_COMPILER)
|
||||
set(CMAKE_${LANG}_COMPILER "")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_${LANG}_COMPILER_ID)
|
||||
set(CMAKE_${LANG}_COMPILER_ID "")
|
||||
endif()
|
||||
|
||||
function(SET_COMPILER_VAR VAR _BOOL)
|
||||
set(CMAKE_${LANG}_COMPILER_IS_${VAR}
|
||||
${_BOOL}
|
||||
CACHE INTERNAL "CMake ${LANG} compiler identification (${VAR})" FORCE)
|
||||
mark_as_advanced(CMAKE_${LANG}_COMPILER_IS_${VAR})
|
||||
endfunction()
|
||||
|
||||
if(("${LANG}" STREQUAL "C" AND CMAKE_COMPILER_IS_GNUCC)
|
||||
OR ("${LANG}" STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX))
|
||||
|
||||
# GNU compiler
|
||||
set_compiler_var(GNU 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER MATCHES "icc.*")
|
||||
|
||||
# Intel icc compiler
|
||||
set_compiler_var(INTEL 1)
|
||||
set_compiler_var(INTEL_ICC 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER MATCHES "icpc.*")
|
||||
|
||||
# Intel icpc compiler
|
||||
set_compiler_var(INTEL 1)
|
||||
set_compiler_var(INTEL_ICPC 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "AppleClang")
|
||||
|
||||
# Clang/LLVM compiler
|
||||
set_compiler_var(CLANG 1)
|
||||
set_compiler_var(APPLE_CLANG 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
# Clang/LLVM compiler
|
||||
set_compiler_var(CLANG 1)
|
||||
|
||||
# HIP Clang compiler
|
||||
if(CMAKE_${LANG}_COMPILER MATCHES "hipcc")
|
||||
set_compiler_var(HIPCC 1)
|
||||
endif()
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "PGI")
|
||||
|
||||
# PGI compiler
|
||||
set_compiler_var(PGI 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER MATCHES "xlC" AND UNIX)
|
||||
|
||||
# IBM xlC compiler
|
||||
set_compiler_var(XLC 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER MATCHES "aCC" AND UNIX)
|
||||
|
||||
# HP aC++ compiler
|
||||
set_compiler_var(HP_ACC 1)
|
||||
|
||||
elseif(
|
||||
CMAKE_${LANG}_COMPILER MATCHES "CC"
|
||||
AND CMAKE_SYSTEM_NAME MATCHES "IRIX"
|
||||
AND UNIX)
|
||||
|
||||
# IRIX MIPSpro CC Compiler
|
||||
set_compiler_var(MIPS 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "Intel")
|
||||
|
||||
set_compiler_var(INTEL 1)
|
||||
|
||||
set(CTYPE ICC)
|
||||
if("${LANG}" STREQUAL "CXX")
|
||||
set(CTYPE ICPC)
|
||||
endif()
|
||||
|
||||
set_compiler_var(INTEL_${CTYPE} 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER MATCHES "MSVC")
|
||||
|
||||
# Windows Visual Studio compiler
|
||||
set_compiler_var(MSVC 1)
|
||||
|
||||
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "NVIDIA")
|
||||
|
||||
# NVCC
|
||||
set_compiler_var(NVIDIA 1)
|
||||
|
||||
endif()
|
||||
|
||||
# set other to no
|
||||
foreach(
|
||||
TYPE
|
||||
GNU
|
||||
INTEL
|
||||
INTEL_ICC
|
||||
INTEL_ICPC
|
||||
APPLE_CLANG
|
||||
CLANG
|
||||
PGI
|
||||
XLC
|
||||
HP_ACC
|
||||
MIPS
|
||||
MSVC
|
||||
NVIDIA
|
||||
HIPCC)
|
||||
if(NOT DEFINED CMAKE_${LANG}_COMPILER_IS_${TYPE})
|
||||
set_compiler_var(${TYPE} 0)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
endforeach()
|
||||
@@ -0,0 +1,165 @@
|
||||
# include guard
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development)
|
||||
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/LICENSE
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}
|
||||
COMPONENT core)
|
||||
|
||||
if(ROCPROFILER_BUILD_DOCS)
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/LICENSE
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}-docs
|
||||
COMPONENT docs)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/LICENSE
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}-tests
|
||||
COMPONENT tests)
|
||||
|
||||
install(
|
||||
DIRECTORY ${PROJECT_SOURCE_DIR}/samples
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}
|
||||
COMPONENT samples)
|
||||
|
||||
install(
|
||||
DIRECTORY ${PROJECT_SOURCE_DIR}/tests
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}
|
||||
COMPONENT tests)
|
||||
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/requirements.txt
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests
|
||||
COMPONENT tests)
|
||||
|
||||
install(
|
||||
EXPORT ${PACKAGE_NAME}-targets
|
||||
FILE ${PACKAGE_NAME}-targets.cmake
|
||||
NAMESPACE ${PACKAGE_NAME}::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
COMPONENT development)
|
||||
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/cmake/Modules/rocprofiler-sdk-custom-compilation.cmake
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/rocprofiler-sdk-utilities.cmake
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/Findlibdw.cmake
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/FindrocDecode.cmake
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/FindrocJPEG.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/Modules
|
||||
COMPONENT development)
|
||||
|
||||
rocprofiler_install_env_setup_files(
|
||||
NAME ${PACKAGE_NAME}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}
|
||||
COMPONENT development)
|
||||
|
||||
function(compute_rocprofiler_sdk_version _VAR)
|
||||
string(REGEX REPLACE "([0-9]+)\\\.([0-9]+)\\\.(.*)" "\\1.\\2" _TMP "${${_VAR}}")
|
||||
set(PACKAGE_${_VAR}
|
||||
"${_TMP}.0...${_TMP}.999999999999"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
compute_rocprofiler_sdk_version(amd_comgr_VERSION)
|
||||
compute_rocprofiler_sdk_version(hsa-runtime64_VERSION)
|
||||
compute_rocprofiler_sdk_version(hip_VERSION)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
# install tree
|
||||
#
|
||||
set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(PROJECT_BUILD_TARGETS headers shared-library)
|
||||
set(PROJECT_EXTRA_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}"
|
||||
"${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
|
||||
configure_package_config_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
|
||||
PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
|
||||
|
||||
write_basic_package_version_file(
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMinorVersion)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/rocprofiler_config_nolink_target.cmake
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-nolink-target.cmake
|
||||
COPYONLY)
|
||||
|
||||
foreach(_FILE rocprofiler-sdk-custom-compilation.cmake rocprofiler-sdk-utilities.cmake
|
||||
Findlibdw.cmake)
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules/${_FILE}
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/Modules/${_FILE}
|
||||
COPYONLY)
|
||||
endforeach()
|
||||
|
||||
install(
|
||||
FILES
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-nolink-target.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
COMPONENT development)
|
||||
|
||||
export(PACKAGE ${PACKAGE_NAME})
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
# build tree
|
||||
#
|
||||
set(${PACKAGE_NAME}_BUILD_TREE
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
|
||||
set(PROJECT_BUILD_TREE_TARGETS headers shared-library build-flags stack-protector dw)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-build-config.cmake
|
||||
@ONLY)
|
||||
|
||||
file(RELATIVE_PATH rocp_bin2src_rel_path ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
||||
string(REPLACE "//" "/" rocp_inc_rel_path "${rocp_bin2src_rel_path}/source/include")
|
||||
|
||||
set(_BUILDTREE_EXPORT_DIR
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${rocp_inc_rel_path}
|
||||
${PROJECT_BINARY_DIR}/include WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}")
|
||||
file(MAKE_DIRECTORY "${_BUILDTREE_EXPORT_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
file(TOUCH "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
endif()
|
||||
|
||||
export(
|
||||
EXPORT ${PACKAGE_NAME}-targets
|
||||
NAMESPACE ${PACKAGE_NAME}::
|
||||
FILE "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
|
||||
set(${PACKAGE_NAME}_DIR
|
||||
"${_BUILDTREE_EXPORT_DIR}"
|
||||
CACHE PATH "${PACKAGE_NAME} build tree install" FORCE)
|
||||
@@ -0,0 +1,106 @@
|
||||
# include guard
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME rocpd)
|
||||
set(SDK_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(PACKAGE_NAME "${PROJECT_NAME}-rocpd")
|
||||
|
||||
install(
|
||||
EXPORT ${PACKAGE_NAME}-targets
|
||||
FILE ${PACKAGE_NAME}-targets.cmake
|
||||
NAMESPACE ${PACKAGE_NAME}::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
COMPONENT rocpd)
|
||||
|
||||
rocprofiler_install_env_setup_files(
|
||||
NAME ${PACKAGE_NAME}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}
|
||||
COMPONENT rocpd)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
# install tree
|
||||
#
|
||||
set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(PROJECT_BUILD_TARGETS ${PACKAGE_NAME}-shared-library)
|
||||
set(PROJECT_EXTRA_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}")
|
||||
|
||||
configure_package_config_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
|
||||
PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
|
||||
|
||||
write_basic_package_version_file(
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMinorVersion)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
COMPONENT rocpd)
|
||||
|
||||
export(PACKAGE ${PACKAGE_NAME})
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
# build tree
|
||||
#
|
||||
set(${PACKAGE_NAME}_BUILD_TREE
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
|
||||
set(PROJECT_BUILD_TREE_TARGETS ${SDK_PACKAGE_NAME}::${PACKAGE_NAME}-shared-library
|
||||
${SDK_PACKAGE_NAME}::${SDK_PACKAGE_NAME}-stack-protector)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-build-config.cmake
|
||||
@ONLY)
|
||||
|
||||
file(RELATIVE_PATH rocp_bin2src_rel_path ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
||||
string(REPLACE "//" "/" rocp_inc_rel_path "${rocp_bin2src_rel_path}/source/include")
|
||||
|
||||
set(_BUILDTREE_EXPORT_DIR
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${rocp_inc_rel_path}
|
||||
${PROJECT_BINARY_DIR}/include WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}")
|
||||
file(MAKE_DIRECTORY "${_BUILDTREE_EXPORT_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
file(TOUCH "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
endif()
|
||||
|
||||
export(
|
||||
EXPORT ${PACKAGE_NAME}-targets
|
||||
NAMESPACE ${PACKAGE_NAME}::
|
||||
FILE "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
|
||||
set(${PACKAGE_NAME}_DIR
|
||||
"${_BUILDTREE_EXPORT_DIR}"
|
||||
CACHE PATH "${PACKAGE_NAME} build tree install" FORCE)
|
||||
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/LICENSE
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}
|
||||
COMPONENT rocpd)
|
||||
@@ -0,0 +1,106 @@
|
||||
# include guard
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME roctx)
|
||||
set(SDK_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(PACKAGE_NAME "${PROJECT_NAME}-roctx")
|
||||
|
||||
install(
|
||||
EXPORT ${PACKAGE_NAME}-targets
|
||||
FILE ${PACKAGE_NAME}-targets.cmake
|
||||
NAMESPACE ${PACKAGE_NAME}::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
COMPONENT roctx)
|
||||
|
||||
rocprofiler_install_env_setup_files(
|
||||
NAME ${PACKAGE_NAME}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}
|
||||
COMPONENT roctx)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
# install tree
|
||||
#
|
||||
set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(PROJECT_BUILD_TARGETS ${PACKAGE_NAME}-shared-library)
|
||||
set(PROJECT_EXTRA_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}")
|
||||
|
||||
configure_package_config_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
|
||||
PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
|
||||
|
||||
write_basic_package_version_file(
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMinorVersion)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}
|
||||
COMPONENT roctx)
|
||||
|
||||
export(PACKAGE ${PACKAGE_NAME})
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
# build tree
|
||||
#
|
||||
set(${PACKAGE_NAME}_BUILD_TREE
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
|
||||
set(PROJECT_BUILD_TREE_TARGETS ${SDK_PACKAGE_NAME}::${PACKAGE_NAME}-shared-library
|
||||
${SDK_PACKAGE_NAME}::${SDK_PACKAGE_NAME}-stack-protector)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-build-config.cmake
|
||||
@ONLY)
|
||||
|
||||
file(RELATIVE_PATH rocp_bin2src_rel_path ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
||||
string(REPLACE "//" "/" rocp_inc_rel_path "${rocp_bin2src_rel_path}/source/include")
|
||||
|
||||
set(_BUILDTREE_EXPORT_DIR
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${rocp_inc_rel_path}
|
||||
${PROJECT_BINARY_DIR}/include WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}")
|
||||
file(MAKE_DIRECTORY "${_BUILDTREE_EXPORT_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
file(TOUCH "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
endif()
|
||||
|
||||
export(
|
||||
EXPORT ${PACKAGE_NAME}-targets
|
||||
NAMESPACE ${PACKAGE_NAME}::
|
||||
FILE "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake")
|
||||
|
||||
set(${PACKAGE_NAME}_DIR
|
||||
"${_BUILDTREE_EXPORT_DIR}"
|
||||
CACHE PATH "${PACKAGE_NAME} build tree install" FORCE)
|
||||
|
||||
install(
|
||||
FILES ${PROJECT_SOURCE_DIR}/LICENSE
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}
|
||||
COMPONENT roctx)
|
||||
@@ -0,0 +1,371 @@
|
||||
# include guard
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
include(rocprofiler_config_nolink_target)
|
||||
|
||||
# ########################################################################################
|
||||
#
|
||||
# External Packages are found here
|
||||
#
|
||||
# ########################################################################################
|
||||
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-headers
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/include>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/include>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
target_compile_definitions(
|
||||
rocprofiler-sdk-headers INTERFACE $<BUILD_INTERFACE:AMD_INTERNAL_BUILD=1>
|
||||
$<BUILD_INTERFACE:__HIP_PLATFORM_AMD__=1>)
|
||||
|
||||
# ensure the env overrides the appending /opt/rocm later
|
||||
string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}")
|
||||
|
||||
set(ROCPROFILER_DEFAULT_ROCM_PATH
|
||||
/opt/rocm
|
||||
CACHE PATH "Default search path for ROCM")
|
||||
|
||||
if(EXISTS ${ROCPROFILER_DEFAULT_ROCM_PATH})
|
||||
get_filename_component(_ROCPROFILER_DEFAULT_ROCM_PATH
|
||||
"${ROCPROFILER_DEFAULT_ROCM_PATH}" REALPATH)
|
||||
|
||||
if(NOT "${_ROCPROFILER_DEFAULT_ROCM_PATH}" STREQUAL
|
||||
"${ROCPROFILER_DEFAULT_ROCM_PATH}")
|
||||
set(ROCPROFILER_DEFAULT_ROCM_PATH
|
||||
"${_ROCPROFILER_DEFAULT_ROCM_PATH}"
|
||||
CACHE PATH "Default search path for ROCM" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# Threading
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG OFF)
|
||||
|
||||
find_library(pthread_LIBRARY NAMES pthread pthreads)
|
||||
find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
|
||||
|
||||
find_library(pthread_LIBRARY NAMES pthread pthreads)
|
||||
find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
|
||||
|
||||
if(pthread_LIBRARY)
|
||||
target_link_libraries(rocprofiler-sdk-threading INTERFACE ${pthread_LIBRARY})
|
||||
else()
|
||||
find_package(Threads ${rocprofiler_FIND_QUIETLY} ${rocprofiler_FIND_REQUIREMENT})
|
||||
|
||||
if(Threads_FOUND)
|
||||
target_link_libraries(rocprofiler-sdk-threading INTERFACE Threads::Threads)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# dynamic linking (dl) and runtime (rt) libraries
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
foreach(_LIB dl rt)
|
||||
find_library(${_LIB}_LIBRARY NAMES ${_LIB})
|
||||
find_package_handle_standard_args(${_LIB}-library REQUIRED_VARS ${_LIB}_LIBRARY)
|
||||
|
||||
if(${_LIB}_LIBRARY)
|
||||
target_link_libraries(rocprofiler-sdk-threading INTERFACE ${${_LIB}_LIBRARY})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# atomic library
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-atomic INTERFACE atomic)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# filesystem library
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
if(NOT ROCPROFILER_BUILD_GHC_FS)
|
||||
if(CMAKE_CXX_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
|
||||
target_link_libraries(rocprofiler-sdk-cxx-filesystem INTERFACE stdc++fs)
|
||||
elseif(CMAKE_CXX_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
target_link_libraries(rocprofiler-sdk-cxx-filesystem INTERFACE c++fs)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# HIP
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(rocm_version 6.2)
|
||||
|
||||
if(rocm_version_FOUND)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${rocm_version_DIR}" "${rocm_version_DIR}/llvm")
|
||||
list(APPEND CMAKE_MODULE_PATH "${rocm_version_DIR}/hip/cmake"
|
||||
"${rocm_version_DIR}/lib/cmake")
|
||||
endif()
|
||||
|
||||
find_package(
|
||||
hip
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATHS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH})
|
||||
|
||||
if(hip_VERSION VERSION_LESS "6.2")
|
||||
message(FATAL_ERROR "HIP version is ${hip_VERSION}, requires at least 6.2")
|
||||
endif()
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-hip INTERFACE hip::host)
|
||||
rocprofiler_config_nolink_target(rocprofiler-sdk-hip-nolink hip::host)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# HSA runtime
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(
|
||||
hsa-runtime64
|
||||
1.14
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATHS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH})
|
||||
|
||||
string(REPLACE "." ";" HSA_RUNTIME_VERSION "${hsa-runtime64_VERSION}")
|
||||
|
||||
# the following values are encoded into version.h
|
||||
list(GET HSA_RUNTIME_VERSION 0 HSA_RUNTIME_VERSION_MAJOR)
|
||||
list(GET HSA_RUNTIME_VERSION 1 HSA_RUNTIME_VERSION_MINOR)
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-hsa-runtime INTERFACE hsa-runtime64::hsa-runtime64)
|
||||
rocprofiler_config_nolink_target(rocprofiler-sdk-hsa-runtime-nolink
|
||||
hsa-runtime64::hsa-runtime64)
|
||||
|
||||
rocprofiler_parse_hsa_api_table_versions(rocprofiler-sdk-hsa-runtime-nolink)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# amd comgr
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(
|
||||
amd_comgr
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATHS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATH_SUFFIXES
|
||||
lib/cmake/amd_comgr)
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-amd-comgr INTERFACE amd_comgr)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# PTL (Parallel Tasking Library)
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-ptl INTERFACE PTL::ptl-static)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# libelf
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(libelf REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-elf INTERFACE libelf::libelf)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# libdw
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(libdw REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-dw INTERFACE libdw::libdw)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# amd aql
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_library(
|
||||
hsa-amd-aqlprofile64_library
|
||||
NAMES hsa-amd-aqlprofile64 hsa-amd-aqlprofile
|
||||
HINTS ${rocm_version_DIR} ${ROCM_PATH}
|
||||
PATHS ${rocm_version_DIR} ${ROCM_PATH})
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-hsa-aql INTERFACE ${hsa-amd-aqlprofile64_library})
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# HSAKMT
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(
|
||||
hsakmt
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATHS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATH_SUFFIXES
|
||||
lib/cmake/hsakmt)
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-hsakmt INTERFACE hsakmt::hsakmt)
|
||||
rocprofiler_config_nolink_target(rocprofiler-sdk-hsakmt-nolink hsakmt::hsakmt)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# drm
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_path(
|
||||
drm_INCLUDE_DIR
|
||||
NAMES drm.h
|
||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||
PATH_SUFFIXES include/drm include/libdrm include REQUIRED)
|
||||
|
||||
find_path(
|
||||
xf86drm_INCLUDE_DIR
|
||||
NAMES xf86drm.h
|
||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||
PATH_SUFFIXES include/drm include/libdrm include REQUIRED)
|
||||
|
||||
find_library(
|
||||
drm_LIBRARY
|
||||
NAMES drm
|
||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
||||
|
||||
find_library(
|
||||
drm_amdgpu_LIBRARY
|
||||
NAMES drm_amdgpu
|
||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
||||
|
||||
target_include_directories(rocprofiler-sdk-drm SYSTEM INTERFACE ${drm_INCLUDE_DIR}
|
||||
${xf86drm_INCLUDE_DIR})
|
||||
target_link_libraries(rocprofiler-sdk-drm INTERFACE ${drm_LIBRARY} ${drm_amdgpu_LIBRARY})
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# ELFIO library
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
# get_target_property(ELFIO_INCLUDE_DIR elfio::elfio INTERFACE_INCLUDE_DIRECTORIES)
|
||||
# target_include_directories(rocprofiler-sdk-elfio SYSTEM INTERFACE ${ELFIO_INCLUDE_DIR})
|
||||
target_link_libraries(rocprofiler-sdk-elfio INTERFACE elfio::elfio)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# OTF2
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-otf2 INTERFACE otf2::otf2)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# RCCL
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(
|
||||
rccl
|
||||
CONFIG
|
||||
HINTS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATHS
|
||||
${rocm_version_DIR}
|
||||
${ROCM_PATH}
|
||||
PATH_SUFFIXES
|
||||
lib/cmake/rccl)
|
||||
|
||||
if(NOT ROCPROFILER_INTERNAL_RCCL_API_TRACE
|
||||
AND rccl_FOUND
|
||||
AND rccl_INCLUDE_DIR
|
||||
AND EXISTS "${rccl_INCLUDE_DIR}/rccl/amd_detail/api_trace.h")
|
||||
set(rccl_API_TRACE_FOUND ON)
|
||||
rocprofiler_config_nolink_target(rocprofiler-sdk-rccl-nolink rccl::rccl)
|
||||
else()
|
||||
set(rccl_API_TRACE_FOUND OFF)
|
||||
target_compile_definitions(rocprofiler-sdk-rccl-nolink
|
||||
INTERFACE ROCPROFILER_SDK_USE_SYSTEM_RCCL=0)
|
||||
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# ROCDecode
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(rocDecode)
|
||||
|
||||
if(rocDecode_FOUND
|
||||
AND rocDecode_INCLUDE_DIR
|
||||
AND EXISTS "${rocDecode_INCLUDE_DIR}/rocdecode/amd_detail/rocdecode_api_trace.h")
|
||||
rocprofiler_config_nolink_target(
|
||||
rocprofiler-sdk-rocdecode-nolink rocdecode::rocdecode INTERFACE
|
||||
ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE=1)
|
||||
else()
|
||||
target_compile_definitions(rocprofiler-sdk-rocdecode-nolink
|
||||
INTERFACE ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE=0)
|
||||
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# rocJPEG
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package(rocJPEG)
|
||||
|
||||
if(rocJPEG_FOUND
|
||||
AND rocJPEG_INCLUDE_DIR
|
||||
AND EXISTS "${rocJPEG_INCLUDE_DIR}/rocjpeg/amd_detail/rocjpeg_api_trace.h")
|
||||
rocprofiler_config_nolink_target(rocprofiler-sdk-rocjpeg-nolink rocjpeg::rocjpeg
|
||||
INTERFACE ROCPROFILER_SDK_USE_SYSTEM_ROCJPEG=1)
|
||||
else()
|
||||
target_compile_definitions(rocprofiler-sdk-rocjpeg-nolink
|
||||
INTERFACE ROCPROFILER_SDK_USE_SYSTEM_ROCJPEG=0)
|
||||
|
||||
endif()
|
||||
@@ -0,0 +1,68 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# function for copying most of a target's properties to another target except for the link
|
||||
# related properties. Function is potentially recursive -- it should not be used if there
|
||||
# is a cyclic target dependency.
|
||||
function(rocprofiler_config_nolink_target _DST _SRC)
|
||||
# skip if not a cmake target but process any extra args
|
||||
if(NOT TARGET "${_SRC}")
|
||||
foreach(_LIB ${ARGN})
|
||||
rocprofiler_config_nolink_target(${_DST} ${_LIB})
|
||||
endforeach()
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_LINK_LIBRARIES)
|
||||
set(_INCLUDE_DIRS)
|
||||
set(_COMPILE_DEFS)
|
||||
set(_COMPILE_OPTS)
|
||||
set(_COMPILE_FEATS)
|
||||
|
||||
set(_PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
|
||||
foreach(_PROPERTY INCLUDE_DIRECTORIES LINK_LIBRARIES COMPILE_DEFINITIONS
|
||||
COMPILE_OPTIONS COMPILE_FEATURES)
|
||||
list(APPEND _PROPERTIES ${_PROPERTY} INTERFACE_${_PROPERTY})
|
||||
endforeach()
|
||||
|
||||
foreach(_PROPERTY ${_PROPERTIES})
|
||||
# get the target property
|
||||
get_target_property(_VAR ${_SRC} ${_PROPERTY})
|
||||
|
||||
if(NOT _VAR)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if("${_PROPERTY}" MATCHES ".*LINK_LIBRARIES$")
|
||||
list(APPEND _LINK_LIBRARIES ${_VAR})
|
||||
elseif("${_PROPERTY}" MATCHES ".*INCLUDE_DIRECTORIES$")
|
||||
list(APPEND _INCLUDE_DIRS ${_VAR})
|
||||
elseif("${_PROPERTY}" MATCHES ".*COMPILE_DEFINITIONS$")
|
||||
list(APPEND _COMPILE_DEFS ${_VAR})
|
||||
elseif("${_PROPERTY}" MATCHES ".*COMPILE_OPTIONS$")
|
||||
list(APPEND _COMPILE_OPTS ${_VAR})
|
||||
elseif("${_PROPERTY}" MATCHES ".*COMPILE_FEATURES$")
|
||||
list(APPEND _COMPILE_FEATS ${_VAR})
|
||||
else()
|
||||
message(SEND_ERROR "Unexpected target property: ${_PROPERTY}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES _LINK_LIBRARIES)
|
||||
list(REMOVE_DUPLICATES _INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES _COMPILE_DEFS)
|
||||
list(REMOVE_DUPLICATES _COMPILE_OPTS)
|
||||
list(REMOVE_DUPLICATES _COMPILE_FEATS)
|
||||
|
||||
target_include_directories(${_DST} SYSTEM INTERFACE ${_INCLUDE_DIRS})
|
||||
target_compile_definitions(${_DST} INTERFACE ${_COMPILE_DEFS})
|
||||
target_compile_options(${_DST} INTERFACE ${_COMPILE_OPTS})
|
||||
target_compile_features(${_DST} INTERFACE ${_COMPILE_FEATS})
|
||||
|
||||
foreach(_LIB ${_LINK_LIBRARIES} ${ARGN})
|
||||
rocprofiler_config_nolink_target(${_DST} ${_LIB})
|
||||
endforeach()
|
||||
endfunction()
|
||||
@@ -0,0 +1,224 @@
|
||||
#
|
||||
# configure packaging settings
|
||||
#
|
||||
|
||||
function(rocprofiler_set_package_depends _VARIABLE _VALUE _INFO _REPLACE_PARENTHESIS)
|
||||
string(REPLACE ";" ", " _DEPENDS "${_VALUE}")
|
||||
if(_REPLACE_PARENTHESIS)
|
||||
string(REGEX REPLACE "\\\(|\\\)" "" _DEPENDS "${_DEPENDS}")
|
||||
endif()
|
||||
set(${_VARIABLE}
|
||||
"${_DEPENDS}"
|
||||
CACHE STRING "${_INFO} package dependencies" FORCE)
|
||||
rocprofiler_add_feature(${_VARIABLE} "${_INFO} package dependencies")
|
||||
endfunction()
|
||||
|
||||
# Make proper version for appending Default Value is 99999
|
||||
set(ROCM_VERSION_FOR_PACKAGE
|
||||
"99999"
|
||||
CACHE STRING "")
|
||||
if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
|
||||
set(ROCM_VERSION_FOR_PACKAGE
|
||||
"$ENV{ROCM_LIBPATCH_VERSION}"
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
# Add packaging directives
|
||||
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
||||
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_CONTACT "ROCm Profiler Support <dl.ROCm-Profiler.support@amd.com>")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
||||
set(CPACK_STRIP_FILES
|
||||
OFF
|
||||
CACHE BOOL "") # eventually this should be set to ON
|
||||
set(ROCPROFILER_CPACK_SYSTEM_NAME
|
||||
"${CMAKE_SYSTEM_NAME}"
|
||||
CACHE STRING "System name, e.g. Linux or Ubuntu-18.04")
|
||||
set(ROCPROFILER_CPACK_PACKAGE_SUFFIX "")
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
"${CPACK_PACKAGE_NAME}-${ROCPROFILER_SDK_VERSION}-${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}"
|
||||
CACHE STRING "")
|
||||
if(DEFINED ENV{CPACK_PACKAGE_FILE_NAME})
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
"$ENV{CPACK_PACKAGE_FILE_NAME}"
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
rocprofiler_add_feature(CPACK_PACKAGE_FILE_NAME "CPack filename")
|
||||
|
||||
get_cmake_property(ROCPROFILER_PACKAGING_COMPONENTS COMPONENTS)
|
||||
|
||||
rocprofiler_add_feature(ROCPROFILER_PACKAGING_COMPONENTS "Packaging components")
|
||||
list(REMOVE_ITEM ROCPROFILER_PACKAGING_COMPONENTS "Development" "Unspecified")
|
||||
list(LENGTH ROCPROFILER_PACKAGING_COMPONENTS NUM_ROCPROFILER_PACKAGING_COMPONENTS)
|
||||
|
||||
# the packages we will generate
|
||||
set(ROCPROFILER_COMPONENT_GROUPS "core" "docs" "tests" "roctx" "rocpd")
|
||||
|
||||
set(COMPONENT_GROUP_core_COMPONENTS "core" "development" "samples" "tools" "benchmark"
|
||||
"Development" "Unspecified")
|
||||
set(COMPONENT_GROUP_docs_COMPONENTS "docs")
|
||||
set(COMPONENT_GROUP_tests_COMPONENTS "tests")
|
||||
set(COMPONENT_GROUP_roctx_COMPONENTS "roctx")
|
||||
set(COMPONENT_GROUP_rocpd_COMPONENTS "rocpd")
|
||||
|
||||
# variables for each component group. Note: eventually we will probably want to separate
|
||||
# the core to just be the runtime libraries, development to be the headers and cmake
|
||||
# files, the samples to just be the samples, and tools just be the tool files but right
|
||||
# now we are just combining core, development, samples, and tools into one package
|
||||
set(COMPONENT_NAME_core "rocprofiler-sdk")
|
||||
set(COMPONENT_NAME_docs "rocprofiler-sdk-docs")
|
||||
set(COMPONENT_NAME_tests "rocprofiler-sdk-tests")
|
||||
set(COMPONENT_NAME_roctx "rocprofiler-sdk-roctx")
|
||||
set(COMPONENT_NAME_rocpd "rocprofiler-sdk-rocpd")
|
||||
|
||||
set(COMPONENT_DEP_core "rocprofiler-sdk-roctx (>= ${PROJECT_VERSION})"
|
||||
"rocprofiler-sdk-rocpd (>= ${PROJECT_VERSION})")
|
||||
set(COMPONENT_DEP_docs "")
|
||||
set(COMPONENT_DEP_tests
|
||||
"rocprofiler-sdk (>= ${PROJECT_VERSION})"
|
||||
"rocprofiler-sdk-roctx (>= ${PROJECT_VERSION})"
|
||||
"rocprofiler-sdk-rocpd (>= ${PROJECT_VERSION})")
|
||||
set(COMPONENT_DEP_roctx "rocprofiler-register")
|
||||
set(COMPONENT_DEP_rocpd "")
|
||||
|
||||
set(COMPONENT_DESC_core "rocprofiler-sdk libraries, headers, samples, and tools")
|
||||
set(COMPONENT_DESC_docs "rocprofiler-sdk documentation")
|
||||
set(COMPONENT_DESC_tests "rocprofiler-sdk tests")
|
||||
set(COMPONENT_DESC_roctx "ROCm Tools Extension library and headers")
|
||||
set(COMPONENT_DESC_rocpd "ROCm Profiling Data library and headers")
|
||||
|
||||
set(EXPECTED_PACKAGING_COMPONENTS 7)
|
||||
if(ROCPROFILER_BUILD_DOCS)
|
||||
math(EXPR EXPECTED_PACKAGING_COMPONENTS "${EXPECTED_PACKAGING_COMPONENTS} + 1")
|
||||
endif()
|
||||
if(ROCPROFILER_BUILD_BENCHMARK)
|
||||
math(EXPR EXPECTED_PACKAGING_COMPONENTS "${EXPECTED_PACKAGING_COMPONENTS} + 1")
|
||||
endif()
|
||||
|
||||
if(NOT NUM_ROCPROFILER_PACKAGING_COMPONENTS EQUAL EXPECTED_PACKAGING_COMPONENTS)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Error new install component needs COMPONENT_NAME_* and COMPONENT_SEP_* entries: ${ROCPROFILER_PACKAGING_COMPONENTS}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "rocm-core")
|
||||
else()
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "")
|
||||
endif()
|
||||
|
||||
foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS})
|
||||
set(_DEP "${COMPONENT_DEP_${COMPONENT_GROUP}}")
|
||||
set(_NAME "${COMPONENT_NAME_${COMPONENT_GROUP}}")
|
||||
set(_DESC "${COMPONENT_DESC_${COMPONENT_GROUP}}")
|
||||
|
||||
cpack_add_component_group(
|
||||
${COMPONENT_GROUP}
|
||||
DISPLAY_NAME "${_NAME}"
|
||||
DESCRIPTION "${_DESC}")
|
||||
|
||||
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
|
||||
list(INSERT _DEP 0 "rocm-core")
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${COMPONENT_GROUP}" UCOMPONENT)
|
||||
set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_NAME "${_NAME}")
|
||||
set(CPACK_RPM_${UCOMPONENT}_PACKAGE_NAME "${_NAME}")
|
||||
|
||||
rocprofiler_set_package_depends(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_DEPENDS "${_DEP}"
|
||||
"Debian" OFF)
|
||||
rocprofiler_set_package_depends(CPACK_RPM_${UCOMPONENT}_PACKAGE_REQUIRES "${_DEP}"
|
||||
"RedHat" ON)
|
||||
|
||||
foreach(COMPONENT ${COMPONENT_GROUP_${COMPONENT_GROUP}_COMPONENTS})
|
||||
cpack_add_component(${COMPONENT} REQUIRED GROUP "${COMPONENT_GROUP}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
#
|
||||
# Debian package specific variables
|
||||
#
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_EPOCH 0)
|
||||
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
||||
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS
|
||||
ON
|
||||
CACHE BOOL "") # auto-generate deps based on shared libs
|
||||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) # generate list of shared libs provided by
|
||||
# package
|
||||
set(CPACK_DEBIAN_TESTS_PACKAGE_SHLIBDEPS OFF) # disable for tests package
|
||||
set(CPACK_DEBIAN_TESTS_PACKAGE_GENERATE_SHLIBS OFF) # disable for tests package
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PROJECT_HOMEPAGE_URL}")
|
||||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
|
||||
if(DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE
|
||||
"$ENV{CPACK_DEBIAN_PACKAGE_RELEASE}"
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
rocprofiler_set_package_depends(CPACK_DEBIAN_PACKAGE_DEPENDS
|
||||
"${CPACK_DEBIAN_PACKAGE_DEPENDS}" "Debian" OFF)
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}")
|
||||
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
#
|
||||
# RPM package specific variables
|
||||
#
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
|
||||
if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX)
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
set(CPACK_RPM_PACKAGE_EPOCH 0)
|
||||
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQ
|
||||
ON
|
||||
CACHE BOOL "") # auto-generate deps based on shared libs
|
||||
set(CPACK_RPM_PACKAGE_AUTOPROV ON) # generate list of shared libs provided by package
|
||||
set(CPACK_RPM_TESTS_PACKAGE_AUTOREQ OFF) # disable for tests package
|
||||
set(CPACK_RPM_TESTS_PACKAGE_AUTOPROV OFF) # disable for tests package
|
||||
if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
|
||||
set(CPACK_RPM_PACKAGE_RELEASE
|
||||
"$ENV{CPACK_RPM_PACKAGE_RELEASE}"
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
# Get rpm distro
|
||||
if(CPACK_RPM_PACKAGE_RELEASE)
|
||||
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
|
||||
endif()
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||
|
||||
# Cpack converts !/usr/bin/env python3 to /usr/libexec/platform-python in RHEL8. prevent
|
||||
# the BRP(buildroot policy) script from checking and modifying interpreter directives
|
||||
set(CPACK_RPM_SPEC_MORE_DEFINE "%undefine __brp_mangle_shebangs")
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
#
|
||||
# Prepare final version for the CPACK use
|
||||
#
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
|
||||
# Prepare final version for the CPACK use
|
||||
set(CPACK_PACKAGE_VERSION
|
||||
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}"
|
||||
)
|
||||
|
||||
include(CPack)
|
||||
@@ -0,0 +1,141 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# creates following targets to format code:
|
||||
# - format
|
||||
# - format-source
|
||||
# - format-cmake
|
||||
# - format-python
|
||||
# - format-rocprofiler-source
|
||||
# - format-rocprofiler-cmake
|
||||
# - format-rocprofiler-python
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
include_guard(DIRECTORY)
|
||||
|
||||
if(ROCPROFILER_BUILD_DEVELOPER)
|
||||
set(_FMT_REQUIRED REQUIRED)
|
||||
else()
|
||||
set(_FMT_REQUIRED)
|
||||
endif()
|
||||
|
||||
if(NOT ROCPROFILER_CLANG_FORMAT_EXE AND EXISTS $ENV{HOME}/.local/bin/clang-format)
|
||||
execute_process(
|
||||
COMMAND $ENV{HOME}/.local/bin/clang-format --version
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
OUTPUT_VARIABLE _CLANG_FMT_OUT
|
||||
RESULT_VARIABLE _CLANG_FMT_RET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
if(_CLANG_FMT_RET EQUAL 0)
|
||||
if("${_CLANG_FMT_OUT}" MATCHES "version 11\\.([0-9]+)\\.([0-9]+)")
|
||||
set(ROCPROFILER_CLANG_FORMAT_EXE
|
||||
"$ENV{HOME}/.local/bin/clang-format"
|
||||
CACHE FILEPATH "clang-format exe")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(
|
||||
ROCPROFILER_CLANG_FORMAT_EXE ${_FMT_REQUIRED}
|
||||
NAMES clang-format-11 clang-format-mp-11 clang-format
|
||||
PATHS $ENV{HOME}/.local
|
||||
HINTS $ENV{HOME}/.local
|
||||
PATH_SUFFIXES bin)
|
||||
find_program(
|
||||
ROCPROFILER_CMAKE_FORMAT_EXE ${_FMT_REQUIRED}
|
||||
NAMES cmake-format
|
||||
PATHS $ENV{HOME}/.local
|
||||
HINTS $ENV{HOME}/.local
|
||||
PATH_SUFFIXES bin)
|
||||
find_program(
|
||||
ROCPROFILER_BLACK_FORMAT_EXE ${_FMT_REQUIRED}
|
||||
NAMES black
|
||||
PATHS $ENV{HOME}/.local
|
||||
HINTS $ENV{HOME}/.local
|
||||
PATH_SUFFIXES bin)
|
||||
|
||||
add_custom_target(format-rocprofiler)
|
||||
if(NOT TARGET format)
|
||||
add_custom_target(format)
|
||||
endif()
|
||||
foreach(_TYPE source python cmake)
|
||||
if(NOT TARGET format-${_TYPE})
|
||||
add_custom_target(format-${_TYPE})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(ROCPROFILER_CLANG_FORMAT_EXE
|
||||
OR ROCPROFILER_BLACK_FORMAT_EXE
|
||||
OR ROCPROFILER_CMAKE_FORMAT_EXE)
|
||||
|
||||
set(rocp_source_files)
|
||||
set(rocp_header_files)
|
||||
set(rocp_python_files)
|
||||
set(rocp_cmake_files ${PROJECT_SOURCE_DIR}/CMakeLists.txt
|
||||
${PROJECT_SOURCE_DIR}/external/CMakeLists.txt)
|
||||
|
||||
foreach(_DIR cmake samples source tests benchmark)
|
||||
foreach(_TYPE header_files source_files cmake_files python_files)
|
||||
set(${_TYPE})
|
||||
endforeach()
|
||||
file(GLOB_RECURSE header_files ${PROJECT_SOURCE_DIR}/${_DIR}/*.h
|
||||
${PROJECT_SOURCE_DIR}/${_DIR}/*.hpp ${PROJECT_SOURCE_DIR}/${_DIR}/*.h.in
|
||||
${PROJECT_SOURCE_DIR}/${_DIR}/*.hpp.in)
|
||||
file(GLOB_RECURSE source_files ${PROJECT_SOURCE_DIR}/${_DIR}/*.c
|
||||
${PROJECT_SOURCE_DIR}/${_DIR}/*.cpp)
|
||||
file(GLOB_RECURSE cmake_files ${PROJECT_SOURCE_DIR}/${_DIR}/*CMakeLists.txt
|
||||
${PROJECT_SOURCE_DIR}/${_DIR}/*.cmake)
|
||||
file(GLOB_RECURSE python_files ${PROJECT_SOURCE_DIR}/${_DIR}/*.py
|
||||
${PROJECT_SOURCE_DIR}/${_DIR}/*.py.in)
|
||||
foreach(_TYPE header_files source_files cmake_files python_files)
|
||||
list(APPEND rocp_${_TYPE} ${${_TYPE}})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
foreach(_TYPE header_files source_files cmake_files python_files)
|
||||
if(rocp_${_TYPE})
|
||||
list(REMOVE_DUPLICATES rocp_${_TYPE})
|
||||
list(SORT rocp_${_TYPE})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(ROCPROFILER_CLANG_FORMAT_EXE)
|
||||
add_custom_target(
|
||||
format-rocprofiler-source
|
||||
${ROCPROFILER_CLANG_FORMAT_EXE} -i ${rocp_header_files} ${rocp_source_files}
|
||||
COMMENT
|
||||
"[rocprofiler] Running source formatter ${ROCPROFILER_CLANG_FORMAT_EXE}..."
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BLACK_FORMAT_EXE AND rocp_python_files)
|
||||
add_custom_target(
|
||||
format-rocprofiler-python
|
||||
${ROCPROFILER_BLACK_FORMAT_EXE} -q ${rocp_python_files}
|
||||
COMMENT
|
||||
"[rocprofiler] Running python formatter ${ROCPROFILER_BLACK_FORMAT_EXE}..."
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_CMAKE_FORMAT_EXE)
|
||||
add_custom_target(
|
||||
format-rocprofiler-cmake
|
||||
${ROCPROFILER_CMAKE_FORMAT_EXE} -i ${rocp_cmake_files}
|
||||
COMMENT
|
||||
"[rocprofiler] Running cmake formatter ${ROCPROFILER_CMAKE_FORMAT_EXE}..."
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(_TYPE source python cmake)
|
||||
if(TARGET format-rocprofiler-${_TYPE})
|
||||
add_dependencies(format-rocprofiler format-rocprofiler-${_TYPE})
|
||||
add_dependencies(format-${_TYPE} format-rocprofiler-${_TYPE})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_TYPE source python cmake)
|
||||
if(TARGET format-rocprofiler-${_TYPE})
|
||||
add_dependencies(format format-rocprofiler-${_TYPE})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -0,0 +1,112 @@
|
||||
#
|
||||
#
|
||||
# Forward declaration of all INTERFACE targets
|
||||
#
|
||||
#
|
||||
|
||||
include(rocprofiler_utilities)
|
||||
|
||||
#
|
||||
# interfaces for build flags
|
||||
#
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-headers
|
||||
"Provides minimal set of include flags to compile with rocprofiler")
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-build-flags "Provides generalized build flags for rocprofiler"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-threading
|
||||
"Enables multithreading support" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-perfetto "Enables Perfetto support"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-otf2 "Enables OTF2 support" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-cereal "Enables Cereal support"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-sqlite3 "Enables SQLite3 support"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-pybind11 "Enables PyBind11 support"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-gotcha "Enables GOTCHA support"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-compile-definitions
|
||||
"Compile definitions" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-static-libgcc
|
||||
"Link to static version of libgcc" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-static-libstdcxx
|
||||
"Link to static version of libstdc++" INTERNAL)
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-developer-flags "Compiler flags for developers (more warnings, etc.)"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-debug-flags
|
||||
"Compiler flags for more debug info" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-release-flags
|
||||
"Compiler flags for more debug info" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-stack-protector
|
||||
"Adds stack-protector compiler flags" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-memcheck INTERFACE INTERNAL)
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-experimental-flags
|
||||
"Compiler flags for experimental feature compilation" INTERNAL)
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-deprecated-flags
|
||||
"Compiler flags for deprecated feature usage warnings" INTERNAL)
|
||||
|
||||
#
|
||||
# interfaces for libraries (general)
|
||||
#
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-dl
|
||||
"Build flags for dynamic linking library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-rt "Build flags for runtime library"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-atomic "atomic library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-gtest "Google Test library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-glog "Google Log library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-fmt "C++ format string library"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-cxx-filesystem "C++ filesystem library"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-ptl "Parallel Tasking Library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-elf "ElfUtils elf library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-dw "ElfUtils dw library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-elfio "ELFIO header-only C++ library"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-yaml-cpp "YAML CPP Parser" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-json "nlohmann json" INTERNAL)
|
||||
|
||||
#
|
||||
# interface for libraries (ROCm-specific)
|
||||
#
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-hip "HIP library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-hsa-runtime "HSA runtime library"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-amd-comgr "AMD comgr library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-hsa-aql "AQL library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-hsakmt
|
||||
"HSAKMT library for AMD KFD support" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-drm "drm (amdgpu) library" INTERNAL)
|
||||
|
||||
#
|
||||
# "nolink" interface targets emulate another interface target but do not link to the
|
||||
# library. E.g. rocprofiler-sdk-hip-nolink has the include directories, compile
|
||||
# definitions, and compile options of rocprofiler-sdk-hip but does not link to the HIP
|
||||
# runtime library
|
||||
#
|
||||
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-hip-nolink "rocprofiler-sdk-hip without linking to HIP library"
|
||||
IMPORTED)
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-hsa-runtime-nolink
|
||||
"rocprofiler-sdk-hsa-runtime without linking to HSA library" IMPORTED)
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-hsakmt-nolink
|
||||
"rocprofiler-sdk-hsakmt without linking to HSAKMT library" IMPORTED)
|
||||
rocprofiler_add_interface_library(rocprofiler-sdk-rccl-nolink
|
||||
"RCCL headers without linking to RCCL library" IMPORTED)
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-rocdecode-nolink
|
||||
"ROCDECODE headers without linking to ROCDECODE library" IMPORTED)
|
||||
|
||||
rocprofiler_add_interface_library(
|
||||
rocprofiler-sdk-rocjpeg-nolink "ROCJPEG headers without linking to ROCJPEG library"
|
||||
IMPORTED)
|
||||
@@ -0,0 +1,76 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# Clang Tidy
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
if(ROCPROFILER_BUILD_DEVELOPER)
|
||||
set(_TIDY_REQUIRED REQUIRED)
|
||||
else()
|
||||
set(_TIDY_REQUIRED)
|
||||
endif()
|
||||
|
||||
if(NOT ROCPROFILER_CLANG_TIDY_EXE AND EXISTS $ENV{HOME}/.local/bin/clang-tidy)
|
||||
execute_process(
|
||||
COMMAND $ENV{HOME}/.local/bin/clang-tidy --version
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
OUTPUT_VARIABLE _CLANG_TIDY_OUT
|
||||
RESULT_VARIABLE _CLANG_TIDY_RET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
|
||||
if(_CLANG_TIDY_RET EQUAL 0)
|
||||
if("${_CLANG_TIDY_OUT}" MATCHES "version 1[5-9]\\.([0-9]+)\\.([0-9]+)")
|
||||
set(ROCPROFILER_CLANG_TIDY_EXE
|
||||
"$ENV{HOME}/.local/bin/clang-tidy"
|
||||
CACHE FILEPATH "clang-tidy exe")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(
|
||||
ROCPROFILER_CLANG_TIDY_EXE ${_TIDY_REQUIRED}
|
||||
NAMES clang-tidy-18
|
||||
clang-tidy-17
|
||||
clang-tidy-16
|
||||
clang-tidy-15
|
||||
clang-tidy-14
|
||||
clang-tidy-13
|
||||
clang-tidy-12
|
||||
clang-tidy-11
|
||||
clang-tidy
|
||||
PATHS $ENV{HOME}/.local
|
||||
HINTS $ENV{HOME}/.local
|
||||
PATH_SUFFIXES bin)
|
||||
|
||||
macro(ROCPROFILER_ACTIVATE_CLANG_TIDY)
|
||||
if(ROCPROFILER_ENABLE_CLANG_TIDY)
|
||||
if(NOT ROCPROFILER_CLANG_TIDY_EXE)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"ROCPROFILER_ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
|
||||
endif()
|
||||
|
||||
rocprofiler_add_feature(ROCPROFILER_CLANG_TIDY_EXE
|
||||
"path to clang-tidy executable")
|
||||
|
||||
set(CMAKE_CXX_CLANG_TIDY
|
||||
${ROCPROFILER_CLANG_TIDY_EXE} -header-filter=${PROJECT_SOURCE_DIR}/source/.*
|
||||
--warnings-as-errors=*,-misc-header-include-cycle)
|
||||
|
||||
# Create a preprocessor definition that depends on .clang-tidy content so the
|
||||
# compile command will change when .clang-tidy changes. This ensures that a
|
||||
# subsequent build re-runs clang-tidy on all sources even if they do not otherwise
|
||||
# need to be recompiled. Nothing actually uses this definition. We add it to
|
||||
# targets on which we run clang-tidy just to get the build dependency on the
|
||||
# .clang-tidy file.
|
||||
file(SHA1 ${PROJECT_SOURCE_DIR}/.clang-tidy clang_tidy_sha1)
|
||||
set(CLANG_TIDY_DEFINITIONS "CLANG_TIDY_SHA1=${clang_tidy_sha1}")
|
||||
unset(clang_tidy_sha1)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ROCPROFILER_DEACTIVATE_CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY)
|
||||
endmacro()
|
||||
@@ -0,0 +1,107 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
set(ROCPROFILER_MEMCHECK_TYPES "ThreadSanitizer" "AddressSanitizer" "LeakSanitizer"
|
||||
"UndefinedBehaviorSanitizer")
|
||||
|
||||
if(ROCPROFILER_MEMCHECK AND NOT ROCPROFILER_MEMCHECK IN_LIST ROCPROFILER_MEMCHECK_TYPES)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unsupported memcheck type '${ROCPROFILER_MEMCHECK}'. Options: ${ROCPROFILER_MEMCHECK_TYPES}"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_property(CACHE ROCPROFILER_MEMCHECK PROPERTY STRINGS "${ROCPROFILER_MEMCHECK_TYPES}")
|
||||
|
||||
function(rocprofiler_add_memcheck_flags _TYPE _LIB_BASE _FLAG)
|
||||
target_compile_options(
|
||||
rocprofiler-sdk-memcheck
|
||||
INTERFACE $<BUILD_INTERFACE:-g3 -Og -fno-omit-frame-pointer
|
||||
-fno-optimize-sibling-calls -fno-inline-functions -fsanitize=${_FLAG}
|
||||
${ARGN}>)
|
||||
target_link_options(rocprofiler-sdk-memcheck INTERFACE
|
||||
$<BUILD_INTERFACE:-fsanitize=${_FLAG} -Wl,--no-undefined>)
|
||||
|
||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp)
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/source/scripts/deduce-sanitizer-lib.sh
|
||||
lib${_LIB_BASE} ${CMAKE_CXX_COMPILER} -fsanitize=${_FLAG}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp
|
||||
RESULT_VARIABLE _DEDUCE_RET
|
||||
ERROR_VARIABLE _DEDUCE_ERR
|
||||
OUTPUT_VARIABLE _DEDUCE_OUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(_DEDUCE_RET EQUAL 0 AND EXISTS "${_DEDUCE_OUT}")
|
||||
set(${_TYPE}_LIBRARY
|
||||
"${_DEDUCE_OUT}"
|
||||
CACHE FILEPATH "Linked library when compiled with -fsanitize=${_FLAG}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(rocprofiler_set_memcheck_env _TYPE _LIB_BASE)
|
||||
if(NOT ${_TYPE}_LIBRARY)
|
||||
set(_LIBS ${_LIB_BASE})
|
||||
|
||||
foreach(_N ${ARGN} 6 5 4 3 2 1 0)
|
||||
list(
|
||||
APPEND
|
||||
_LIBS
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}${_LIB_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}.${_N}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
foreach(_LIB ${_LIBS})
|
||||
if(NOT ${_TYPE}_LIBRARY)
|
||||
find_library(${_TYPE}_LIBRARY NAMES ${_LIB})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-memcheck INTERFACE ${_LIB_BASE})
|
||||
|
||||
if(${_TYPE}_LIBRARY)
|
||||
set(ROCPROFILER_MEMCHECK_PRELOAD_ENV
|
||||
"LD_PRELOAD=${${_TYPE}_LIBRARY}"
|
||||
CACHE INTERNAL "LD_PRELOAD env variable for tests " FORCE)
|
||||
set(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE
|
||||
"${${_TYPE}_LIBRARY}"
|
||||
CACHE INTERNAL "Library to LD_PRELOAD for tests " FORCE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# always unset so that it doesn't preload if memcheck disabled
|
||||
unset(ROCPROFILER_MEMCHECK_PRELOAD_ENV CACHE)
|
||||
unset(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE CACHE)
|
||||
|
||||
# the soversions below are fallbacks in case deduce-sanitizer-lib.sh fails
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION
|
||||
VERSION_GREATER_EQUAL "13.0.0")
|
||||
set(ThreadSanitizer_SOVERSION 2)
|
||||
set(AddressSanitizer_SOVERSION 8)
|
||||
else()
|
||||
set(ThreadSanitizer_SOVERSION 0)
|
||||
set(AddressSanitizer_SOVERSION 6)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_MEMCHECK STREQUAL "AddressSanitizer")
|
||||
rocprofiler_add_memcheck_flags("${ROCPROFILER_MEMCHECK}" "asan" "address")
|
||||
rocprofiler_set_memcheck_env("${ROCPROFILER_MEMCHECK}" "asan"
|
||||
${AddressSanitizer_SOVERSION})
|
||||
elseif(ROCPROFILER_MEMCHECK STREQUAL "LeakSanitizer")
|
||||
rocprofiler_add_memcheck_flags("${ROCPROFILER_MEMCHECK}" "lsan" "leak")
|
||||
rocprofiler_set_memcheck_env("${ROCPROFILER_MEMCHECK}" "lsan")
|
||||
elseif(ROCPROFILER_MEMCHECK STREQUAL "ThreadSanitizer")
|
||||
rocprofiler_add_memcheck_flags("${ROCPROFILER_MEMCHECK}" "tsan" "thread")
|
||||
rocprofiler_set_memcheck_env("${ROCPROFILER_MEMCHECK}" "tsan"
|
||||
${ThreadSanitizer_SOVERSION})
|
||||
elseif(ROCPROFILER_MEMCHECK STREQUAL "UndefinedBehaviorSanitizer")
|
||||
rocprofiler_add_memcheck_flags("${ROCPROFILER_MEMCHECK}" "ubsan" "undefined"
|
||||
"-fno-sanitize-recover=undefined")
|
||||
rocprofiler_set_memcheck_env("${ROCPROFILER_MEMCHECK}" "ubsan")
|
||||
elseif(NOT ROCPROFILER_MEMCHECK STREQUAL "")
|
||||
message(FATAL_ERROR "Unsupported ROCPROFILER_MEMCHECK type: ${ROCPROFILER_MEMCHECK}")
|
||||
endif()
|
||||
@@ -0,0 +1,164 @@
|
||||
#
|
||||
# rocprofiler_options.cmake
|
||||
#
|
||||
# Configure miscellaneous settings
|
||||
#
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# export compile commands of the project. Many IDEs want the compile_commands.json in root
|
||||
# directory so run ln -s <build>/compile_commands.json
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
# C settings
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_VISIBILITY_PRESET "hidden")
|
||||
# C++ settings
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
|
||||
# general settings affecting build
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||
set(CMAKE_UNITY_BUILD OFF)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
rocprofiler_add_feature(CMAKE_BUILD_TYPE "Build type")
|
||||
rocprofiler_add_feature(CMAKE_INSTALL_PREFIX "Install prefix")
|
||||
|
||||
# standard cmake options
|
||||
rocprofiler_add_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
# rocprofiler_add_option(BUILD_STATIC_LIBS "Build static libraries" OFF)
|
||||
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_BUILD_CI "Enable continuous integration default values for options" OFF
|
||||
ADVANCED)
|
||||
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_TESTS "Enable building the tests"
|
||||
${ROCPROFILER_BUILD_CI})
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_SAMPLES "Enable building the code samples"
|
||||
${ROCPROFILER_BUILD_CI})
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_BENCHMARK "Enable building the benchmarks" OFF)
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_BUILD_CI_STRICT_TIMESTAMPS
|
||||
"Disable adjusting for clock skew b/t CPU and GPU timestamps" OFF ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_CODECOV
|
||||
"Enable building for code coverage analysis" OFF)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_DOCS
|
||||
"Enable build + install + packaging documentation" OFF)
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_INTERNAL_RCCL_API_TRACE
|
||||
"Use (internal) <rocprofiler-sdk/rccl/details/api_trace.h> instead of RCCL-provided <rccl/amd_detail/api_trace.h>. Note: this should never be used in production"
|
||||
OFF
|
||||
ADVANCED)
|
||||
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_BUILD_GHC_FS
|
||||
"Enable building with ghc::filesystem library (via submodule) instead of the C++ filesystem library"
|
||||
ON)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_FMT "Enable building fmt library internally" ON)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_GLOG
|
||||
"Enable building glog (Google logging) library internally" ON)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_SQLITE3
|
||||
"Enable building sqlite3 library internally" OFF)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_PYBIND11
|
||||
"Enable building pybind11 library internally" ON)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_GOTCHA
|
||||
"Enable building gotcha library internally" ON)
|
||||
if(ROCPROFILER_BUILD_TESTS)
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_BUILD_GTEST
|
||||
"Enable building gtest (Google testing) library internally" ON ADVANCED)
|
||||
endif()
|
||||
|
||||
rocprofiler_add_option(ROCPROFILER_ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF
|
||||
ADVANCED)
|
||||
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_BUILD_DEVELOPER "Extra build flags for development like -Werror"
|
||||
${ROCPROFILER_BUILD_CI} ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_WERROR "Any compiler warnings are errors"
|
||||
${ROCPROFILER_BUILD_CI} ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_RELEASE "Build with minimal debug info" OFF
|
||||
ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_DEBUG "Build with extra debug info" OFF ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_STATIC_LIBGCC
|
||||
"Build with -static-libgcc if possible" OFF ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_STATIC_LIBSTDCXX
|
||||
"Build with -static-libstdc++ if possible" OFF ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_STACK_PROTECTOR "Build with -fstack-protector"
|
||||
ON ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_UNSAFE_NO_VERSION_CHECK
|
||||
"Disable HSA version checking (for development only)" OFF ADVANCED)
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_REGENERATE_COUNTERS_PARSER
|
||||
"Regenerate the counter parser (requires bison and flex)" OFF ADVANCED)
|
||||
rocprofiler_add_option(
|
||||
ROCPROFILER_BUILD_EXPERIMENTAL_WARNINGS
|
||||
"Enable warnings for experimental features but hide with -Wno-deprecated-declarations (this ensures that experimental warning message does not break macros)"
|
||||
OFF
|
||||
ADVANCED)
|
||||
rocprofiler_add_option(ROCPROFILER_BUILD_DEPRECATED_WARNINGS
|
||||
"Enable warnings for use of deprecated features" OFF ADVANCED)
|
||||
|
||||
# In the future, we will do this even with clang-tidy enabled
|
||||
foreach(_OPT ROCPROFILER_BUILD_DEVELOPER ROCPROFILER_BUILD_WERROR)
|
||||
if(ROCPROFILER_BUILD_CI AND NOT ${_OPT})
|
||||
message(AUTHOR_WARNING "Forcing ${_OPT}=ON because ROCPROFILER_BUILD_CI=ON")
|
||||
set(${_OPT}
|
||||
ON
|
||||
CACHE BOOL "forced due ROCPROFILER_BUILD_CI=ON" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(ROCPROFILER_BUILD_TYPES "Release" "RelWithDebInfo" "Debug" "MinSizeRel" "Coverage")
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
"Release"
|
||||
CACHE STRING "Build type" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE IN_LIST ROCPROFILER_BUILD_TYPES)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unsupported build type '${CMAKE_BUILD_TYPE}'. Options: ${ROCPROFILER_BUILD_TYPES}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_CI)
|
||||
foreach(_BUILD_TYPE ${ROCPROFILER_BUILD_TYPES})
|
||||
string(TOUPPER "${_BUILD_TYPE}" _BUILD_TYPE)
|
||||
|
||||
# remove NDEBUG preprocessor def so that asserts are triggered
|
||||
string(REGEX REPLACE ".DNDEBUG" "" CMAKE_C_FLAGS_${_BUILD_TYPE}
|
||||
"${CMAKE_C_FLAGS_${_BUILD_TYPE}}")
|
||||
string(REGEX REPLACE ".DNDEBUG" "" CMAKE_CXX_FLAGS_${_BUILD_TYPE}
|
||||
"${CMAKE_CXX_FLAGS_${_BUILD_TYPE}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${ROCPROFILER_BUILD_TYPES}")
|
||||
endif()
|
||||
|
||||
rocprofiler_add_cache_option(ROCPROFILER_MEMCHECK "" STRING "Memory checker type"
|
||||
ADVANCED)
|
||||
|
||||
# ASAN is defined by testing team on Jenkins
|
||||
if(ASAN)
|
||||
set(ROCPROFILER_MEMCHECK
|
||||
"AddressSanitizer"
|
||||
CACHE STRING "Memory checker type (forced by ASAN defined)" FORCE)
|
||||
endif()
|
||||
|
||||
include(rocprofiler_memcheck)
|
||||
|
||||
# default FAIL_REGULAR_EXPRESSION for tests
|
||||
set(ROCPROFILER_DEFAULT_FAIL_REGEX
|
||||
"threw an exception|Permission denied|Could not create logging file|failed with error code|Subprocess aborted"
|
||||
CACHE INTERNAL "Default FAIL_REGULAR_EXPRESSION for tests" FORCE)
|
||||
|
||||
# this should be defaulted to OFF by ROCm 7.0.1 or 7.1 this should only used to disable
|
||||
# sample tests in extreme circumstances
|
||||
option(ROCPROFILER_DISABLE_UNSTABLE_CTESTS "Disable unstable tests" ON)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
ARG BASE_IMAGE=rocm/rocm-terminal
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ARG BRANCH=amd-staging
|
||||
|
||||
RUN git clone -b ${BRANCH} https://github.com/ROCm/rocprofiler-sdk.git rocprofiler-sdk-source && \
|
||||
python3 -m pip install -r rocprofiler-sdk-source/requirements.txt && \
|
||||
sudo apt update && \
|
||||
sudo apt install -y libdw-dev libsqlite3-dev && \
|
||||
cmake -B rocprofiler-sdk-build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DROCPROFILER_BUILD_{SAMPLES,TESTS,BENCHMARK}=ON -DPython3_EXECUTABLE=$(which python3) -DCMAKE_INSTALL_PREFIX=$(realpath /opt/rocm) rocprofiler-sdk-source && \
|
||||
cmake --build rocprofiler-sdk-build --target all --parallel 16 && \
|
||||
sudo cmake --build rocprofiler-sdk-build --target install && \
|
||||
sudo rm -rf rocprofiler-sdk-source rocprofiler-sdk-build
|
||||
@@ -0,0 +1,342 @@
|
||||
#
|
||||
#
|
||||
# External dependencies
|
||||
#
|
||||
#
|
||||
include(rocprofiler_utilities)
|
||||
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0077 NEW) # option() honors normal variables
|
||||
|
||||
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}][external] ")
|
||||
|
||||
set(BUILD_TESTING OFF)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(BUILD_OBJECT_LIBS OFF) # Specific to PTL
|
||||
set(BUILD_STATIC_LIBS ON)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||
|
||||
# filesystem library
|
||||
if(ROCPROFILER_BUILD_GHC_FS)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/filesystem
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/gulrak/filesystem.git
|
||||
REPO_BRANCH "v1.5.14")
|
||||
|
||||
target_compile_definitions(
|
||||
rocprofiler-sdk-cxx-filesystem
|
||||
INTERFACE $<BUILD_INTERFACE:ROCPROFILER_HAS_GHC_LIB_FILESYSTEM=1>)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-cxx-filesystem SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/filesystem/include>)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_TESTS)
|
||||
if(ROCPROFILER_BUILD_GTEST)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules
|
||||
# file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/googletest
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/google/googletest.git
|
||||
REPO_BRANCH "main")
|
||||
|
||||
set(BUILD_GMOCK OFF)
|
||||
set(INSTALL_GTEST OFF)
|
||||
add_subdirectory(googletest EXCLUDE_FROM_ALL)
|
||||
|
||||
if(NOT TARGET GTest::gtest)
|
||||
message(FATAL_ERROR "missing GTest::gtest")
|
||||
endif()
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-gtest INTERFACE GTest::gtest)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-gtest SYSTEM
|
||||
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include)
|
||||
|
||||
mark_as_advanced(INSTALL_GTEST)
|
||||
mark_as_advanced(BUILD_GMOCK)
|
||||
mark_as_advanced(GTEST_HAS_ABSL)
|
||||
else()
|
||||
find_package(GTest REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-gtest INTERFACE GTest::gtest)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_GLOG)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/glog
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/google/glog.git
|
||||
REPO_BRANCH "master")
|
||||
|
||||
# May want to use GFLAGS in the future
|
||||
set(WITH_GFLAGS OFF)
|
||||
set(WITH_GTEST OFF)
|
||||
set(WITH_UNWIND "none")
|
||||
add_subdirectory(glog EXCLUDE_FROM_ALL)
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-glog INTERFACE $<BUILD_INTERFACE:glog::glog>)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-glog SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/glog>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/glog/src>)
|
||||
else()
|
||||
find_package(glog REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-glog INTERFACE glog::glog)
|
||||
endif()
|
||||
|
||||
if(ROCPROFILER_BUILD_FMT)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/fmt
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/fmtlib/fmt.git
|
||||
REPO_BRANCH "master")
|
||||
|
||||
set(FMT_TEST OFF)
|
||||
add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-fmt INTERFACE $<BUILD_INTERFACE:fmt::fmt>)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-fmt SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/fmt/include>)
|
||||
else()
|
||||
find_package(fmt REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-fmt INTERFACE fmt::fmt)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET PTL::ptl-static)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RELATIVE_PATH external/ptl
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/jrmadsen/PTL.git
|
||||
REPO_BRANCH rocprofiler)
|
||||
|
||||
set(PTL_USE_TBB OFF)
|
||||
set(PTL_USE_GPU OFF)
|
||||
set(PTL_USE_LOCKS ON)
|
||||
set(PTL_BUILD_EXAMPLES OFF)
|
||||
set(PTL_DEVELOPER_INSTALL OFF)
|
||||
add_subdirectory(ptl EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/yaml-cpp
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/jbeder/yaml-cpp.git
|
||||
REPO_BRANCH "master")
|
||||
|
||||
add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL)
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-yaml-cpp
|
||||
INTERFACE $<BUILD_INTERFACE:yaml-cpp::yaml-cpp>)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-yaml-cpp
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/yaml-cpp/include>)
|
||||
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/cereal
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/jrmadsen/cereal.git
|
||||
REPO_BRANCH "rocprofiler")
|
||||
|
||||
target_compile_definitions(rocprofiler-sdk-cereal
|
||||
INTERFACE $<BUILD_INTERFACE:CEREAL_THREAD_SAFE=1>)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-cereal
|
||||
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cereal/include>)
|
||||
|
||||
# doxygen-awesome
|
||||
if(ROCPROFILER_BUILD_DOCS)
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/doxygen-awesome-css
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
TEST_FILE Makefile
|
||||
REPO_URL https://github.com/jothepro/doxygen-awesome-css.git
|
||||
REPO_BRANCH "main")
|
||||
endif()
|
||||
|
||||
# perfetto
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/perfetto
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
TEST_FILE meson.build
|
||||
REPO_URL https://github.com/google/perfetto
|
||||
REPO_BRANCH "v44.0")
|
||||
|
||||
add_library(rocprofiler-sdk-perfetto-static-library STATIC)
|
||||
target_sources(
|
||||
rocprofiler-sdk-perfetto-static-library
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.h
|
||||
${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.cc)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-perfetto-static-library SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/perfetto/sdk>)
|
||||
set_target_properties(
|
||||
rocprofiler-sdk-perfetto-static-library
|
||||
PROPERTIES POSITION_INDEPENDENT_CODE ON OUTPUT_NAME rocprofiler-sdk-perfetto)
|
||||
target_link_libraries(
|
||||
rocprofiler-sdk-perfetto
|
||||
INTERFACE $<BUILD_INTERFACE:rocprofiler-sdk-perfetto-static-library>)
|
||||
|
||||
# ELFIO
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/elfio
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/serge1/ELFIO.git
|
||||
REPO_BRANCH "Release_3.12")
|
||||
|
||||
set(ELFIO_BUILD_EXAMPLES OFF)
|
||||
set(ELFIO_BUILD_TESTS OFF)
|
||||
add_subdirectory(elfio EXCLUDE_FROM_ALL)
|
||||
if(TARGET rocprofiler-sdk-elfio)
|
||||
get_target_property(ELFIO_INCLUDE_DIR elfio::elfio INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(rocprofiler-sdk-elfio SYSTEM
|
||||
INTERFACE ${ELFIO_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
#
|
||||
# OTF2
|
||||
#
|
||||
add_subdirectory(otf2)
|
||||
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/json
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/nlohmann/json.git
|
||||
REPO_BRANCH "develop")
|
||||
|
||||
#
|
||||
# JSON
|
||||
#
|
||||
add_subdirectory(json)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-json SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/json/include>)
|
||||
|
||||
#
|
||||
# SQLite3
|
||||
#
|
||||
if(ROCPROFILER_BUILD_SQLITE3)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/sqlite
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
TEST_FILE configure
|
||||
REPO_URL https://github.com/sqlite/sqlite
|
||||
REPO_BRANCH "version-3.47.0")
|
||||
|
||||
find_program(
|
||||
MAKE_COMMAND
|
||||
NAMES make gmake
|
||||
PATH_SUFFIXES bin REQUIRED)
|
||||
|
||||
include(ExternalProject)
|
||||
externalproject_add(
|
||||
rocprofiler-sdk-sqlite-build
|
||||
PREFIX ${PROJECT_BINARY_DIR}/external/sqlite/build
|
||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/sqlite
|
||||
BUILD_IN_SOURCE 0
|
||||
CONFIGURE_COMMAND
|
||||
<SOURCE_DIR>/configure --prefix=${PROJECT_BINARY_DIR}/external/sqlite/install
|
||||
--libdir=${PROJECT_BINARY_DIR}/external/sqlite/install/lib
|
||||
--enable-tempstore=yes --enable-all --disable-tcl --with-pic CFLAGS=-O3\ -g1
|
||||
BUILD_COMMAND ${MAKE_COMMAND} install -s
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-sdk-sqlite3
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/sqlite/install/lib/libsqlite3.so>
|
||||
)
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-sqlite3 SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/sqlite/install/include>
|
||||
)
|
||||
add_dependencies(rocprofiler-sdk-sqlite3 rocprofiler-sdk-sqlite-build)
|
||||
else()
|
||||
find_package(SQLite3 REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-sqlite3 INTERFACE SQLite::SQLite3)
|
||||
endif()
|
||||
|
||||
#
|
||||
# PyBind11
|
||||
#
|
||||
if(ROCPROFILER_BUILD_PYBIND11)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/pybind11
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/pybind/pybind11.git
|
||||
REPO_BRANCH "v2.9.2")
|
||||
|
||||
target_include_directories(
|
||||
rocprofiler-sdk-pybind11 SYSTEM
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/pybind11/include>)
|
||||
else()
|
||||
find_package(pybind11 REQUIRED)
|
||||
target_link_libraries(rocprofiler-sdk-pybind11 INTERFACE pybind11::pybind11)
|
||||
endif()
|
||||
|
||||
#
|
||||
# GOTCHA
|
||||
#
|
||||
if(ROCPROFILER_BUILD_GOTCHA)
|
||||
# checkout submodule if not already checked out or clone repo if no .gitmodules file
|
||||
rocprofiler_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/gotcha
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
REPO_URL https://github.com/jrmadsen/GOTCHA.git
|
||||
REPO_BRANCH "rocprofiler")
|
||||
|
||||
function(add_gotcha_subdirectory)
|
||||
set(GOTCHA_ENABLE_TESTS OFF)
|
||||
set(GOTCHA_ENABLE_WARNING_ERROR OFF)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprofiler-sdk")
|
||||
add_subdirectory(gotcha EXCLUDE_FROM_ALL)
|
||||
add_dependencies(rocprofiler-sdk-gotcha gotcha)
|
||||
install(
|
||||
TARGETS gotcha
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk"
|
||||
OPTIONAL)
|
||||
endfunction()
|
||||
|
||||
add_gotcha_subdirectory()
|
||||
|
||||
target_link_libraries(rocprofiler-sdk-gotcha INTERFACE gotcha::gotcha)
|
||||
else()
|
||||
find_package(gotcha REQUIRED)
|
||||
if(TARGET gotcha::gotcha)
|
||||
target_link_libraries(rocprofiler-sdk-gotcha INTERFACE gotcha::gotcha)
|
||||
elseif(TARGET gotcha)
|
||||
target_link_libraries(rocprofiler-sdk-gotcha INTERFACE gotcha)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cmake_policy(POP)
|
||||
+1
Submodule projects/rocprofiler-sdk/external/cereal added at e736e75d9d
+1
Submodule projects/rocprofiler-sdk/external/doxygen-awesome-css added at df83fbf22c
+1
Submodule projects/rocprofiler-sdk/external/elfio added at 8ae6cec5d6
+1
Submodule projects/rocprofiler-sdk/external/filesystem added at 8a2edd6d92
+1
Submodule projects/rocprofiler-sdk/external/fmt added at 0bffed8957
+1
Submodule projects/rocprofiler-sdk/external/glog added at 34b8da6496
+1
Submodule projects/rocprofiler-sdk/external/googletest added at 46db91ef6f
+1
Submodule projects/rocprofiler-sdk/external/gotcha added at 9afbaf0ae5
+1
Submodule projects/rocprofiler-sdk/external/json added at e41905fcb0
@@ -0,0 +1,74 @@
|
||||
# ======================================================================================
|
||||
# Builds OTF2
|
||||
# ======================================================================================
|
||||
|
||||
set(ROCPROFILER_BINARY_DIR ${PROJECT_BINARY_DIR})
|
||||
set(OTF2_VERSION
|
||||
"3.0.3"
|
||||
CACHE STRING "OTF2 version")
|
||||
set(OTF2_URL_HASH
|
||||
"SHA256=18a3905f7917340387e3edc8e5766f31ab1af41f4ecc5665da6c769ca21c4ee8"
|
||||
CACHE STRING "OTF2 URL download hash")
|
||||
|
||||
project(
|
||||
OTF2
|
||||
LANGUAGES C
|
||||
VERSION ${OTF2_VERSION}
|
||||
DESCRIPTION "Open Trace Format v2"
|
||||
HOMEPAGE_URL "https://perftools.pages.jsc.fz-juelich.de/cicd/otf2")
|
||||
|
||||
include(FetchContent)
|
||||
include(ExternalProject)
|
||||
include(ProcessorCount)
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
endif()
|
||||
|
||||
set(FETCHCONTENT_BASE_DIR ${ROCPROFILER_BINARY_DIR}/external/packages)
|
||||
|
||||
fetchcontent_declare(
|
||||
otf2-source
|
||||
URL https://perftools.pages.jsc.fz-juelich.de/cicd/otf2/tags/otf2-${OTF2_VERSION}/otf2-${OTF2_VERSION}.tar.gz
|
||||
URL_HASH ${OTF2_URL_HASH})
|
||||
|
||||
fetchcontent_makeavailable(otf2-source)
|
||||
|
||||
set(_otf2_root ${ROCPROFILER_BINARY_DIR}/external/otf2)
|
||||
set(_otf2_inc_dirs $<BUILD_INTERFACE:${_otf2_root}/include>)
|
||||
set(_otf2_lib_dirs $<BUILD_INTERFACE:${_otf2_root}/${CMAKE_INSTALL_LIBDIR}>)
|
||||
set(_otf2_libs
|
||||
$<BUILD_INTERFACE:${_otf2_root}/${CMAKE_INSTALL_LIBDIR}/libotf2${CMAKE_STATIC_LIBRARY_SUFFIX}>
|
||||
)
|
||||
set(_otf2_build_byproducts
|
||||
"${_otf2_root}/include/otf2/otf2.h"
|
||||
"${_otf2_root}/${CMAKE_INSTALL_LIBDIR}/libotf2${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
|
||||
find_program(
|
||||
MAKE_COMMAND
|
||||
NAMES make gmake
|
||||
PATH_SUFFIXES bin REQUIRED)
|
||||
|
||||
externalproject_add(
|
||||
otf2-build
|
||||
PREFIX ${_otf2_root}
|
||||
SOURCE_DIR ${otf2-source_SOURCE_DIR}
|
||||
BUILD_IN_SOURCE 1
|
||||
DOWNLOAD_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
CONFIGURE_COMMAND
|
||||
${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
<SOURCE_DIR>/configure -q --enable-silent-rules --prefix=${_otf2_root}
|
||||
--libdir=${_otf2_root}/${CMAKE_INSTALL_LIBDIR} CFLAGS=-fPIC\ -O3\ -g
|
||||
CXXFLAGS=-fPIC\ -O3\ -g LDFLAGS= PYTHON=: SPHINX=:
|
||||
BUILD_COMMAND ${MAKE_COMMAND} install -s
|
||||
BUILD_BYPRODUCTS "${_otf2_build_byproducts}"
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
add_library(otf2 INTERFACE)
|
||||
add_library(otf2::otf2 ALIAS otf2)
|
||||
target_include_directories(otf2 SYSTEM INTERFACE ${_otf2_inc_dirs})
|
||||
target_link_directories(otf2 INTERFACE ${_otf2_lib_dirs})
|
||||
target_link_libraries(otf2 INTERFACE ${_otf2_libs})
|
||||
|
||||
add_dependencies(otf2 otf2-build)
|
||||
+1
Submodule projects/rocprofiler-sdk/external/perfetto added at eb5ef24c58
+1
Submodule projects/rocprofiler-sdk/external/ptl added at 48df416254
+1
Submodule projects/rocprofiler-sdk/external/pybind11 added at 914c06fb25
Some files were not shown because too many files have changed in this diff Show More
Viittaa uudesa ongelmassa
Block a user