{"id":18711227,"url":"https://github.com/rocm/hcc","last_synced_at":"2025-12-12T01:03:04.412Z","repository":{"id":60721096,"uuid":"54489277","full_name":"ROCm/hcc","owner":"ROCm","description":"HCC is an Open Source, Optimizing C++ Compiler for Heterogeneous Compute currently for the ROCm GPU Computing Platform","archived":false,"fork":false,"pushed_at":"2020-06-10T05:18:49.000Z","size":23626,"stargazers_count":420,"open_issues_count":115,"forks_count":110,"subscribers_count":53,"default_branch":"clang_tot_upgrade","last_synced_at":"2024-06-23T08:18:29.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/RadeonOpenCompute/hcc/wiki","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ROCm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-22T16:04:00.000Z","updated_at":"2024-06-20T16:35:31.000Z","dependencies_parsed_at":"2022-10-03T19:30:59.214Z","dependency_job_id":null,"html_url":"https://github.com/ROCm/hcc","commit_stats":null,"previous_names":["rocm/hcc","radeonopencompute/hcc"],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fhcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fhcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fhcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fhcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ROCm","download_url":"https://codeload.github.com/ROCm/hcc/tar.gz/refs/heads/clang_tot_upgrade","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271532,"owners_count":20911587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T12:38:01.497Z","updated_at":"2025-12-12T01:03:04.368Z","avatar_url":"https://github.com/ROCm.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"HCC : An open source C++ compiler for heterogeneous devices\n===========================================================\nThis repository hosts the HCC compiler implementation project. The goal is to \nimplement a compiler that takes a program that conforms to a parallel programming \nstandard such as HC, C++ 17 ParallelSTL and transforms it \ninto the AMD GCN ISA.\n\nThe project is based on LLVM+CLANG. For more information, please visit the \n[hcc wiki][1]:\n\n[https://github.com/RadeonOpenCompute/hcc/wiki][1]\n\nDeprecation Notice\n==================\nAMD is deprecating HCC to put more focus on HIP development and on other languages supporting heterogeneous compute.    We will no longer develop any new feature in HCC and we will stop maintaining HCC after its final release, which is planned for June 2019.  If your application was developed with the hc C++ API, we would encourage you to transition it to other languages supported by AMD, such as [HIP](https://github.com/ROCm-Developer-Tools/HIP) or OpenCL.    HIP and hc language share the same compiler technology, so many hc kernel language features (including inline assembly) are also available through the HIP compilation path.\n\nDownload HCC\n============\nThe project now employs git submodules to manage external components it depends \nupon. It it advised to add `--recursive` when you clone the project so all \nsubmodules are fetched automatically.\n\nFor example:\n```bash\n# automatically fetches all submodules\ngit clone --recursive -b clang_tot_upgrade https://github.com/RadeonOpenCompute/hcc.git\n```\n\nFor more information about git submodules, please refer to [git documentation][2].\n\nBuild HCC from source\n=====================\nTo configure and build HCC from source, use the following steps:\n```bash\nmkdir -p build; cd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\nmake\n```\n\nTo install it, use the following steps:\n```bash\nsudo make install\n```\n\nUse HCC\n=======\n\nFor HC source codes:\n```bash\nhcc -hc foo.cpp -o foo\n```\n\nMultiple ISA\n============\n\nHCC now supports having multiple GCN ISAs in one executable file. You can do it \nin different ways:\n\nuse `--amdgpu-target=` command line option\n------------------------------------------\nIt's possible to specify multiple `--amdgpu-target=` option. Example:\n\n```bash\n# ISA for Fiji(gfx803) and Vega10(gfx900) would \n# be produced\nhcc -hc \\\n    --amdgpu-target=gfx803 \\\n    --amdgpu-target=gfx900 \\\n    foo.cpp\n```\n\nconfigure HCC use CMake `HSA_AMDGPU_GPU_TARGET` variable\n---------------------------------------------------------\nIf you build HCC from source, it's possible to configure it to automatically\nproduce multiple ISAs via `HSA_AMDGPU_GPU_TARGET` CMake variable.\n\nUse `;` to delimit each AMDGPU target. Example:\n\n```bash\n# ISA for Fiji(gfx803) and Vega10(gfx900) would \n# be produced by default\ncmake \\\n    -DCMAKE_BUILD_TYPE=Release \\\n    -DHSA_AMDGPU_GPU_TARGET=\"gfx803;gfx900\" \\\n    ../hcc\n```\n\nCodeXL Activity Logger\n======================\nTo enable the [CodeXL Activity Logger][7], use the `USE_CODEXL_ACTIVITY_LOGGER` \nenvironment variable.\n\nConfigure the build in the following way: \n\n```bash\ncmake \\\n    -DCMAKE_BUILD_TYPE=Release \\\n    -DUSE_CODEXL_ACTIVITY_LOGGER=1 \\\n    \u003cToT HCC checkout directory\u003e\n```\n\nIn your application compiled using hcc, include the CodeXL Activity Logger header:\n```\n#include \u003cCXLActivityLogger.h\u003e\n```\n\nFor information about the usage of the Activity Logger for profiling, please \nrefer to its [documentation][8].\n\nHCC with ThinLTO Linking\n========================\nTo enable the ThinLTO link time, use the `KMTHINLTO` environment variable.\n\nSet up your environment in the following way:\n```\nexport KMTHINLTO=1\n```\nThinLTO Phase 1 - Implemented\n-----------------------------\nFor applications compiled using hcc, ThinLTO could significantly improve link-time\nperformance. This implementation will maintain kernels in their .bc file format,\ncreate module-summaries for each, perform llvm-lto's cross-module function importing\nand then perform clamp-device (which uses opt and llc tools) on each of the\nkernel files. These files are linked with lld into one .hsaco per target specified.\n\nThinLTO Phase 2 - Under development\n-----------------------------------\nThis ThinLTO implementation which will use llvm-lto LLVM tool to replace\nclamp-device bash script. It adds an optllc option into ThinLTOGenerator,\nwhich will perform in-program opt and codegen in parallel.\n\nTo use HCC Printf Functions\n===========================\nSet up environmental variable:\n```bash\nexport HCC_ENABLE_PRINTF=1\n```\n\nThen compile the printf kernel with HCC_ENABLE_ACCELERATOR_PRINTF macro defined.\n```bash\n~/build/bin/hcc -hc -DHCC_ENABLE_ACCELERATOR_PRINTF -lhc_am -o printf.out ~/hcc/tests/Unit/HSA/printf.cpp\n```\n\nFor more examples on how to use printf, see tests in `tests/Unit/HSA/printf*.cpp`.\n\n[//]: # (References)\n[1]: https://github.com/RadeonOpenCompute/hcc/wiki\n[2]: https://git-scm.com/book/en/v2/Git-Tools-Submodules\n[7]: https://github.com/RadeonOpenCompute/ROCm-Profiler/tree/master/CXLActivityLogger\n[8]: https://github.com/RadeonOpenCompute/ROCm-Profiler/blob/master/CXLActivityLogger/doc/AMDTActivityLogger.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocm%2Fhcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocm%2Fhcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocm%2Fhcc/lists"}