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
004eb2c6
Commit
004eb2c6
authored
1 month ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Auto align in hercules box
parent
f7a35a6d
No related branches found
No related tags found
1 merge request
!190
Set up cava benchmark
Pipeline
#201764
failed
1 month ago
Stage: test
This commit is part of merge request
!190
. Comments created here will be created in the context of that merge request.
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.lock
+3
-0
3 additions, 0 deletions
Cargo.lock
hercules_rt/Cargo.toml
+1
-1
1 addition, 1 deletion
hercules_rt/Cargo.toml
hercules_rt/src/lib.rs
+28
-11
28 additions, 11 deletions
hercules_rt/src/lib.rs
with
32 additions
and
12 deletions
Cargo.lock
+
3
−
0
Edit
View file @
004eb2c6
...
...
@@ -1065,6 +1065,9 @@ dependencies = [
[[package]]
name = "hercules_rt"
version = "0.1.0"
dependencies = [
"aligned-vec",
]
[[package]]
name = "hercules_tests"
...
...
This diff is collapsed.
Click to expand it.
hercules_rt/Cargo.toml
+
1
−
1
Edit
View file @
004eb2c6
...
...
@@ -9,4 +9,4 @@ cuda = []
debug
=
[]
[dependencies]
aligned-vec
=
"*"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
hercules_rt/src/lib.rs
+
28
−
11
Edit
View file @
004eb2c6
...
...
@@ -4,9 +4,10 @@ use std::alloc::{alloc, dealloc, Layout};
use
std
::
marker
::
PhantomData
;
use
std
::
ptr
::{
copy_nonoverlapping
,
write_bytes
,
NonNull
};
use
std
::
slice
::{
from_raw_parts
,
from_raw_parts_mut
};
use
std
::
sync
::
OnceLock
;
use
aligned_vec
::
AVec
;
/*
* Define supporting types, functions, and macros for Hercules RT functions. For
* a more in-depth discussion of the design of these utilities, see hercules_cg/
...
...
@@ -463,7 +464,7 @@ unsafe impl Sync for __RawPtrSendSync {}
*/
pub
struct
HerculesImmBox
<
'a
,
T
>
{
#[allow(dead_code)]
cpu_alloc
:
OnceLock
<
Vec
<
T
>>
,
cpu_alloc
:
OnceLock
<
A
Vec
<
T
>>
,
#[cfg(feature
=
"cuda"
)]
cuda_alloc
:
OnceLock
<
CUDABox
>
,
...
...
@@ -472,16 +473,32 @@ pub struct HerculesImmBox<'a, T> {
cuda_ref
:
OnceLock
<
HerculesCUDARef
<
'a
>>
,
}
impl
<
'a
,
T
>
From
<&
'a
[
T
]
>
for
HerculesImmBox
<
'a
,
T
>
{
impl
<
'a
,
T
:
Clone
>
From
<&
'a
[
T
]
>
for
HerculesImmBox
<
'a
,
T
>
{
fn
from
(
value
:
&
'a
[
T
])
->
Self
{
HerculesImmBox
{
cpu_alloc
:
OnceLock
::
new
(),
#[cfg(feature
=
"cuda"
)]
cuda_alloc
:
OnceLock
::
new
(),
cpu_ref
:
OnceLock
::
from
(
HerculesCPURef
::
from_slice
(
value
)),
#[cfg(feature
=
"cuda"
)]
cuda_ref
:
OnceLock
::
new
(),
if
value
.as_ptr
()
.is_aligned_to
(
32
)
{
HerculesImmBox
{
cpu_alloc
:
OnceLock
::
new
(),
#[cfg(feature
=
"cuda"
)]
cuda_alloc
:
OnceLock
::
new
(),
cpu_ref
:
OnceLock
::
from
(
HerculesCPURef
::
from_slice
(
value
)),
#[cfg(feature
=
"cuda"
)]
cuda_ref
:
OnceLock
::
new
(),
}
}
else
{
let
cpu_alloc
=
AVec
::
from_slice
(
32
,
value
);
let
size
=
value
.len
()
*
size_of
::
<
T
>
();
let
cpu_ref
=
unsafe
{
HerculesCPURef
::
__from_parts
(
cpu_alloc
.as_ptr
()
as
*
mut
u8
,
size
)
};
HerculesImmBox
{
cpu_alloc
:
OnceLock
::
from
(
cpu_alloc
),
#[cfg(feature
=
"cuda"
)]
cuda_alloc
:
OnceLock
::
new
(),
cpu_ref
:
OnceLock
::
from
(
cpu_ref
),
#[cfg(feature
=
"cuda"
)]
cuda_ref
:
OnceLock
::
new
(),
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
rarbore2
@rarbore2
mentioned in commit
b00cd2bb
·
1 month ago
mentioned in commit
b00cd2bb
mentioned in commit b00cd2bb08dd90c3aa8e933eec54fd4823c452fd
Toggle commit list
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