Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ else()

set( Tensile_LOGIC "asm_full" CACHE STRING "Tensile to use which logic?")
set( Tensile_CODE_OBJECT_VERSION "4" CACHE STRING "Tensile code_object_version")
set( Tensile_COMPILER "amdclang++" CACHE STRING "Tensile compiler")
if(WIN32)
set( Tensile_COMPILER "clang++.exe" CACHE STRING "Tensile compiler")
else()
set( Tensile_COMPILER "amdclang++" CACHE STRING "Tensile compiler")
endif()
set( Tensile_LIBRARY_FORMAT "msgpack" CACHE STRING "Tensile library format")
set( Tensile_CPU_THREADS "" CACHE STRING "Number of threads for Tensile parallel build")

Expand Down
8 changes: 6 additions & 2 deletions tensilelite/Tensile/Common/GlobalParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ def assignGlobalParameters(config, isaInfoMap: Dict[IsaVersion, IsaInfo]):
globalParameters["ROCmBinPath"] = os.path.join(globalParameters["ROCmPath"], "bin")
globalParameters["ROCmSMIPath"] = locateExe(globalParameters["ROCmBinPath"], "rocm-smi")
globalParameters["ROCmLdPath"] = locateExe(
os.path.join(globalParameters["ROCmPath"], "llvm/bin"), "ld.lld"
os.path.join(globalParameters["ROCmPath"], "lib/llvm/bin"),
"ld.lld" if os.name != "nt" else "ld.lld.exe"
)

if "AsanBuild" in config:
Expand Down Expand Up @@ -582,7 +583,10 @@ def assignGlobalParameters(config, isaInfoMap: Dict[IsaVersion, IsaInfo]):
try:
compiler = "hipcc"
output = subprocess.run(
[compiler, "--version"], check=True, stdout=subprocess.PIPE
[compiler, "--version"], check=True,
stdout=subprocess.PIPE,
# Avoids some warning spam on Windows.
stderr=subprocess.DEVNULL,
).stdout.decode()

for line in output.split("\n"):
Expand Down
5 changes: 4 additions & 1 deletion tensilelite/Tensile/Common/Parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def CPUThreadCount(enable=True):
return 1
else:
if os.name == "nt":
cpu_count = os.cpu_count()
# Windows supports at most 61 workers because the scheduler uses
# WaitForMultipleObjects directly, which has the limit (the limit
# is actually 64, but some handles are needed for accounting).
cpu_count = min(os.cpu_count(), 61)
else:
cpu_count = len(os.sched_getaffinity(0))
cpuThreads = globalParameters["CpuThreads"]
Expand Down
7 changes: 4 additions & 3 deletions tensilelite/Tensile/Common/Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ def isExe(filePath):

def locateExe(defaultPath, exeName): # /opt/rocm/bin, hip-clang
# look in defaultPath first
exePath = os.path.join(defaultPath, exeName)
if isExe(exePath):
return exePath
if defaultPath:
exePath = os.path.join(defaultPath, exeName)
if isExe(exePath):
return exePath
# look in PATH second
for path in os.environ["PATH"].split(os.pathsep):
exePath = os.path.join(path, exeName)
Expand Down
6 changes: 3 additions & 3 deletions tensilelite/Tensile/Toolchain/Component.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,14 @@ def compress(self, srcPath: str, destPath: str, target: str):
Raises:
RuntimeError: If compressing the code object file fails.
"""
devnull = "/dev/null" if os_name != "nt" else "NUL"
args = [
self._component_path,
"--compress",
"--type=o",
"--bundle-align=4096",
f"--targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa-unknown-{target}",
"--input=/dev/null",
f"--input={devnull}",
f"--input={srcPath}",
f"--output={destPath}",
]
Expand Down Expand Up @@ -359,8 +360,7 @@ def __call__(self, srcPaths: List[str], destPath: str):
if os_name == "nt":
# Use args file on Windows b/c the command may exceed the limit of 8191 characters
with open(Path.cwd() / "clang_args.txt", "wt") as file:
file.write(" ".join(srcPaths))
file.flush()
file.write(" ".join(srcPaths).replace('\\', '\\\\'))
args = [*(self.default_args), "-o", destPath, "@clang_args.txt"]
else:
args = [*(self.default_args), *srcPaths, "-o", destPath]
Expand Down
2 changes: 1 addition & 1 deletion tensilelite/Tensile/Toolchain/Validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ToolchainDefaults(NamedTuple):
OFFLOAD_BUNDLER = osSelect(linux="clang-offload-bundler", windows="clang-offload-bundler.exe")
DEVICE_ENUMERATOR = osSelect(linux="rocm_agent_enumerator" if isRhel8() else "amdgpu-arch", windows="hipinfo")
ASSEMBLER = osSelect(linux="amdclang++", windows="clang++.exe")
HIP_CONFIG = osSelect(linux="hipconfig", windows="hipconfig")
HIP_CONFIG = osSelect(linux="hipconfig", windows="hipconfig.exe")


def _supportedComponent(component: str, targets: List[str]) -> bool:
Expand Down
1 change: 1 addition & 0 deletions tensilelite/Tensile/cmake/TensileConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ function(TensileCreateLibraryFiles

add_custom_command(
COMMENT "Generating Tensile Libraries"
USES_TERMINAL
OUTPUT ${Tensile_OUTPUT_PATH}/library
COMMAND ${CommandLine}
)
Expand Down
2 changes: 1 addition & 1 deletion tensilelite/rocisa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#
# ########################################################################
cmake_minimum_required(VERSION 3.15)
project(rocisa LANGUAGES HIP CXX)
project(rocisa LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down