Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify toolchain components at program invocation #1413

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

bstefanuk
Copy link
Contributor

Currently, there is code spread around TensileLt for verifying the selected toolchain, such as checking if a requested compiler is supported, finding the path to the compiler, checking if the offload bundler can be found, and verifying it is executable, among others. Since the toolchain is fixed throughout the execution of Tensile, TensileCreateLibrary, and other programs in the TensileLt project, moving shared toolchain validation logic to a module that is called once in the setup phase of each program improve the maintainability and clarity of the code, but more importantly eliminates occurrences whereby a program crashes several minutes (or more) into its execution because of an improper toolchain component.

Outcomes

  • All toolchain verification code is moved to the setup phase of each of TensileLt's programs.
  • A new module Tensile.Utilities.Toolchain is added to collect shared toolchain verification logic.
  • The parameters CxxCompiler, CCompiler, ClangOffloadBundlerPath, and AssemblerPath are no longer globally accessible.
  • Setting the path to clang-offload-bundler now follows the same CLI pattern as the compiler/assembler, thus the associated environment variable has been removed.

Principles
In an effort to improve coding standards for future developments to hipBLASLt, the following principles were followed when implementing this PR.

  1. Prefer non-global variables: toolchain components are not globally accessible.
    • Effect: Code that require a toolchain component must accept it as a function or class parameter.
  2. Toolchain components must be provided at program invocation, either explicitly or implicitly via defaults.
  3. The program will not make assumptions about the toolchain component based on invalid input, e.g., convert hipcc input to amdclang++ under the hood.
  4. Environment variables can no longer be used to set toolchain components, only to set search paths
  5. Toolchain components will be preferentially searched in /opt/rocm/bin followed by /opt/rocm/lib/llvm/bin followed by the existing PATH variable.
    • Effect: If the user wishes to use a specific non-standard toolchain component, the absolution path must be provided.

Testing

  • All tox tests pass—Environment: Ubuntu 22.04 Docker with ROCm 6.3.0, Python 3.10.12
  • Functional testing via routine invocations for Tensile and TensileCreateLibrary using toolchain defaults.

@bstefanuk bstefanuk self-assigned this Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant