{"id":13648693,"url":"https://github.com/denzp/rust-ptx-linker","last_synced_at":"2025-03-16T14:30:41.224Z","repository":{"id":57675922,"uuid":"93687630","full_name":"denzp/rust-ptx-linker","owner":"denzp","description":"The missing puzzle piece for NVPTX experience with Rust","archived":false,"fork":false,"pushed_at":"2020-03-03T12:10:02.000Z","size":22161,"stargazers_count":48,"open_issues_count":8,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-25T10:20:37.274Z","etag":null,"topics":["cuda","linker","llvm","nvptx","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denzp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-07T23:18:33.000Z","updated_at":"2024-02-19T15:49:53.000Z","dependencies_parsed_at":"2022-09-03T00:00:45.461Z","dependency_job_id":null,"html_url":"https://github.com/denzp/rust-ptx-linker","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denzp%2Frust-ptx-linker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denzp%2Frust-ptx-linker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denzp%2Frust-ptx-linker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denzp%2Frust-ptx-linker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denzp","download_url":"https://codeload.github.com/denzp/rust-ptx-linker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818172,"owners_count":20352629,"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":["cuda","linker","llvm","nvptx","rust"],"created_at":"2024-08-02T01:04:27.689Z","updated_at":"2025-03-16T14:30:40.937Z","avatar_url":"https://github.com/denzp.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Rust PTX Linker\n[![Build Status](https://travis-ci.org/denzp/rust-ptx-linker.svg?branch=master)](https://travis-ci.org/denzp/rust-ptx-linker)\n[![Current Version](https://img.shields.io/crates/v/ptx-linker.svg)](https://crates.io/crates/ptx-linker)\n\nLLVM NVPTX bitcode linker for Rust 🔥 **without external system dependencies** 🔥!\n\n## What's going on in v0.9?\nThe release is important for the linker and existing users.\nThe former approach was using an external `nvptx64-nvidia-cuda` json target specification and `xargo` to automatically compile `libcore`.\n\nAs of *2019-02-06* Rust [received built-in support](https://github.com/rust-lang/rust/pull/57937) for building the CUDA kernels, and which evolved from the experience gained with `ptx-linker` prior `v0.9`.\n\nCurrently, it's possible to jump into a CUDA development with Nightly Rust:\n\n``` bash\n# Install the minimal required version of the linker.\n$ cargo install ptx-linker -f --version \"\u003e= 0.9\"\n\n# Install `libcore` for the CUDA target.\n$ rustup target add nvptx64-nvidia-cuda\n```\n\nMore details about further usage can be found below ([**Advanced usage**](#advanced-usage) section).\n\n## Purpose\nThe linker solves several of issues mentioned in the [NVPTX metabug](https://github.com/rust-lang/rust/issues/38789):\n\n- [x] Non-inlined functions can't be used cross crate - [rust#38787](https://github.com/rust-lang/rust/issues/38787)\n- [x] No \"undefined reference\" error is raised when it should be - [rust#38786](https://github.com/rust-lang/rust/issues/38786)\n\n## Convenient usage\nAt the moment [ptx-builder](https://crates.io/crates/ptx-builder) is recommended approach to build Rust crates that contains CUDA code.\n\n## Advanced usage\nAlternatively, the linker can be used alone.\n\nMake sure you are using a `cdylib` crate type (the step is needed to perform the actual \"linking\").\nAdd to your `Cargo.toml`:\n``` toml\n[lib]\ncrate_type = [\"cdylib\"]\n```\n\nAnd finally, build the PTX assembly file:\n``` bash\n$ cd /path/to/kernels/crate\n$ cargo build --target nvptx64-nvidia-cuda --release\n```\n\nRust will involve `ptx-linker` under-the-hood and the latter will write the assembly at:\n```\ntarget/nvptx64-nvidia-cuda/release/KERNELS_CRATE_NAME.ptx\n```\n\n## How does it work?\nThe linker does the magic without external system dependencies (mainly, LLVM libs) installed.\nThanks to the [rustc-llvm-proxy](https://crates.io/crates/rustc-llvm-proxy) the correct LLVM symbols are being loaded at runtime.\nThe approach also ensures that the linker uses same libraries versions as Rust.\n\n### Windows users!\nUnfortunately, due to LLVM dylib limitations, Windows targets are not supported.\nThe issue can be worked around if the linker is built with a static LLVM, but this requires a tighter integration with the Rust build process.\nCurrently, there is no work is done in this direction, but the situation might change.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenzp%2Frust-ptx-linker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenzp%2Frust-ptx-linker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenzp%2Frust-ptx-linker/lists"}