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
b00cd2bb
Commit
b00cd2bb
authored
1 month ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Auto align in hercules box"
This reverts commit
004eb2c6
.
parent
004eb2c6
No related branches found
No related tags found
1 merge request
!190
Set up cava benchmark
Pipeline
#201765
failed
1 month ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.lock
+0
-3
0 additions, 3 deletions
Cargo.lock
hercules_rt/Cargo.toml
+1
-1
1 addition, 1 deletion
hercules_rt/Cargo.toml
hercules_rt/src/lib.rs
+11
-28
11 additions, 28 deletions
hercules_rt/src/lib.rs
with
12 additions
and
32 deletions
Cargo.lock
+
0
−
3
View file @
b00cd2bb
...
...
@@ -1065,9 +1065,6 @@ 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
View file @
b00cd2bb
...
...
@@ -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
+
11
−
28
View file @
b00cd2bb
...
...
@@ -4,9 +4,8 @@ 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
;
use
std
::
sync
::
OnceLock
;
/*
* Define supporting types, functions, and macros for Hercules RT functions. For
...
...
@@ -464,7 +463,7 @@ unsafe impl Sync for __RawPtrSendSync {}
*/
pub
struct
HerculesImmBox
<
'a
,
T
>
{
#[allow(dead_code)]
cpu_alloc
:
OnceLock
<
A
Vec
<
T
>>
,
cpu_alloc
:
OnceLock
<
Vec
<
T
>>
,
#[cfg(feature
=
"cuda"
)]
cuda_alloc
:
OnceLock
<
CUDABox
>
,
...
...
@@ -473,32 +472,16 @@ pub struct HerculesImmBox<'a, T> {
cuda_ref
:
OnceLock
<
HerculesCUDARef
<
'a
>>
,
}
impl
<
'a
,
T
:
Clone
>
From
<&
'a
[
T
]
>
for
HerculesImmBox
<
'a
,
T
>
{
impl
<
'a
,
T
>
From
<&
'a
[
T
]
>
for
HerculesImmBox
<
'a
,
T
>
{
fn
from
(
value
:
&
'a
[
T
])
->
Self
{
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
(),
}
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
(),
}
}
}
...
...
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