Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
Hercules
Commits
ab75a1d6
Commit
ab75a1d6
authored
3 months ago
by
Praneet Rathi
Browse files
Options
Downloads
Patches
Plain Diff
cuda
parent
6a2e59af
No related branches found
Branches containing commit
No related tags found
1 merge request
!115
GPU backend
Pipeline
#201026
failed
3 months ago
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cargo.lock
+1
-0
1 addition, 0 deletions
Cargo.lock
hercules_opt/src/pass.rs
+29
-22
29 additions, 22 deletions
hercules_opt/src/pass.rs
hercules_rt/build.rs
+1
-0
1 addition, 0 deletions
hercules_rt/build.rs
juno_build/Cargo.toml
+2
-1
2 additions, 1 deletion
juno_build/Cargo.toml
with
33 additions
and
23 deletions
Cargo.lock
+
1
−
0
View file @
ab75a1d6
...
@@ -718,6 +718,7 @@ name = "juno_build"
...
@@ -718,6 +718,7 @@ name = "juno_build"
version = "0.1.0"
version = "0.1.0"
dependencies = [
dependencies = [
"hercules_ir",
"hercules_ir",
"hercules_rt",
"juno_frontend",
"juno_frontend",
"with_builtin_macros",
"with_builtin_macros",
]
]
...
...
This diff is collapsed.
Click to expand it.
hercules_opt/src/pass.rs
+
29
−
22
View file @
ab75a1d6
...
@@ -974,6 +974,9 @@ impl PassManager {
...
@@ -974,6 +974,9 @@ impl PassManager {
println!
(
"{}"
,
cuda_ir
);
println!
(
"{}"
,
cuda_ir
);
println!
(
"{}"
,
rust_rt
);
println!
(
"{}"
,
rust_rt
);
let
output_archive
=
format!
(
"{}/lib{}.a"
,
output_dir
,
module_name
);
println!
(
"{}"
,
output_archive
);
// Write the LLVM IR into a temporary file.
// Write the LLVM IR into a temporary file.
let
tmp_dir
=
TempDir
::
new
()
.unwrap
();
let
tmp_dir
=
TempDir
::
new
()
.unwrap
();
let
mut
llvm_path
=
tmp_dir
.path
()
.to_path_buf
();
let
mut
llvm_path
=
tmp_dir
.path
()
.to_path_buf
();
...
@@ -999,32 +1002,36 @@ impl PassManager {
...
@@ -999,32 +1002,36 @@ impl PassManager {
.expect
(
"Error running clang. Is it installed?"
);
.expect
(
"Error running clang. Is it installed?"
);
assert!
(
clang_process
.wait
()
.unwrap
()
.success
());
assert!
(
clang_process
.wait
()
.unwrap
()
.success
());
// Write the CUDA IR into a temporary file.
let
mut
ar_args
=
vec!
[
"crus"
,
&
output_archive
,
&
llvm_object
];
let
mut
cuda_path
=
tmp_dir
.path
()
.to_path_buf
();
cuda_path
.push
(
format!
(
"{}.cu"
,
module_name
));
let
mut
file
=
File
::
create
(
&
cuda_path
)
.expect
(
"PANIC: Unable to open output CUDA IR file."
);
file
.write_all
(
cuda_ir
.as_bytes
())
.expect
(
"PANIC: Unable to write output CUDA IR file contents."
);
let
cuda_object
=
format!
(
"{}/{}_cuda.o"
,
tmp_dir
.path
()
.to_str
()
.unwrap
(),
module_name
);
let
cuda_object
=
format!
(
"{}/{}_cuda.o"
,
tmp_dir
.path
()
.to_str
()
.unwrap
(),
module_name
);
let
mut
nvcc_process
=
Command
::
new
(
"nvcc"
)
if
cfg!
(
feature
=
"cuda"
)
{
.arg
(
"-c"
)
// Write the CUDA IR into a temporary file.
.arg
(
"-O3"
)
let
mut
cuda_path
=
tmp_dir
.path
()
.to_path_buf
();
.arg
(
"-o"
)
cuda_path
.push
(
format!
(
"{}.cu"
,
module_name
));
.arg
(
&
cuda_object
)
let
mut
file
=
File
::
create
(
&
cuda_path
)
.arg
(
&
cuda_path
)
.expect
(
"PANIC: Unable to open output CUDA IR file."
);
.spawn
()
file
.write_all
(
cuda_ir
.as_bytes
())
.expect
(
"Error running nvcc. Is it installed?"
);
.expect
(
"PANIC: Unable to write output CUDA IR file contents."
);
assert!
(
nvcc_process
.wait
()
.unwrap
()
.success
());
let
mut
nvcc_process
=
Command
::
new
(
"nvcc"
)
.arg
(
"-c"
)
.arg
(
"-O3"
)
.arg
(
"-lcudart"
)
.arg
(
"-L/usr/lib/x86_64-linux-gnu"
)
.arg
(
"-L/usr/local/cuda/lib64"
)
.arg
(
"-o"
)
.arg
(
&
cuda_object
)
.arg
(
&
cuda_path
)
.spawn
()
.expect
(
"Error running nvcc. Is it installed?"
);
assert!
(
nvcc_process
.wait
()
.unwrap
()
.success
());
ar_args
.push
(
&
cuda_object
);
}
let
output_archive
=
format!
(
"{}/lib{}.a"
,
output_dir
,
module_name
);
println!
(
"{}"
,
output_archive
);
let
mut
ar_process
=
Command
::
new
(
"ar"
)
let
mut
ar_process
=
Command
::
new
(
"ar"
)
.arg
(
"crus"
)
.args
(
&
ar_args
)
.arg
(
&
output_archive
)
.arg
(
&
llvm_object
)
.arg
(
&
cuda_object
)
.spawn
()
.spawn
()
.expect
(
"Error running ar. Is it installed?"
);
.expect
(
"Error running ar. Is it installed?"
);
assert!
(
ar_process
.wait
()
.unwrap
()
.success
());
assert!
(
ar_process
.wait
()
.unwrap
()
.success
());
...
...
This diff is collapsed.
Click to expand it.
hercules_rt/build.rs
+
1
−
0
View file @
ab75a1d6
...
@@ -18,6 +18,7 @@ fn main() {
...
@@ -18,6 +18,7 @@ fn main() {
println!
(
"cargo::rustc-link-search=native={}"
,
out_dir
);
println!
(
"cargo::rustc-link-search=native={}"
,
out_dir
);
println!
(
"cargo::rustc-link-search=native=/usr/lib/x86_64-linux-gnu/"
);
println!
(
"cargo::rustc-link-search=native=/usr/lib/x86_64-linux-gnu/"
);
println!
(
"cargo:rustc-link-search=native=/usr/local/cuda/lib64"
);
println!
(
"cargo::rustc-link-lib=static=rtdefs"
);
println!
(
"cargo::rustc-link-lib=static=rtdefs"
);
println!
(
"cargo::rustc-link-lib=cudart"
);
println!
(
"cargo::rustc-link-lib=cudart"
);
println!
(
"cargo::rerun-if-changed=src/rtdefs.cu"
);
println!
(
"cargo::rerun-if-changed=src/rtdefs.cu"
);
...
...
This diff is collapsed.
Click to expand it.
juno_build/Cargo.toml
+
2
−
1
View file @
ab75a1d6
...
@@ -5,9 +5,10 @@ authors = ["Aaron Councilman <aaronjc4@illinois.edu>"]
...
@@ -5,9 +5,10 @@ authors = ["Aaron Councilman <aaronjc4@illinois.edu>"]
edition
=
"2021"
edition
=
"2021"
[features]
[features]
cuda
=
[
"juno_frontend/cuda"
]
cuda
=
[
"juno_frontend/cuda"
,
"hercules_rt/cuda"
]
[dependencies]
[dependencies]
juno_frontend
=
{
path
=
"../juno_frontend"
}
juno_frontend
=
{
path
=
"../juno_frontend"
}
hercules_rt
=
{
path
=
"../hercules_rt"
,
optional
=
true
}
hercules_ir
=
{
path
=
"../hercules_ir"
}
hercules_ir
=
{
path
=
"../hercules_ir"
}
with_builtin_macros
=
"0.1.0"
with_builtin_macros
=
"0.1.0"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment