Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
0b0fb47c
Commit
0b0fb47c
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Removed unneeded variables.
parent
4b3fc4a9
No related branches found
No related tags found
1 merge request
!440
Dopair2 vectorisation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cache.h
+4
-4
4 additions, 4 deletions
src/cache.h
src/runner_doiact_vec.c
+21
-25
21 additions, 25 deletions
src/runner_doiact_vec.c
with
25 additions
and
29 deletions
src/cache.h
+
4
−
4
View file @
0b0fb47c
...
...
@@ -321,8 +321,8 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
if
(
*
last_pj
+
pad
<
cj
->
count
)
*
last_pj
+=
pad
;
}
int
first_pi_align
=
*
first_pi
;
int
last_pj_align
=
*
last_pj
;
const
int
first_pi_align
=
*
first_pi
;
const
int
last_pj_align
=
*
last_pj
;
const
struct
part
*
restrict
parts_i
=
ci
->
parts
;
const
struct
part
*
restrict
parts_j
=
cj
->
parts
;
double
loc
[
3
];
...
...
@@ -535,8 +535,8 @@ cache_read_two_partial_cells_sorted_force(
if
(
*
last_pj
+
pad
<
cj
->
count
)
*
last_pj
+=
pad
;
}
int
first_pi_align
=
*
first_pi
;
int
last_pj_align
=
*
last_pj
;
const
int
first_pi_align
=
*
first_pi
;
const
int
last_pj_align
=
*
last_pj
;
const
struct
part
*
restrict
parts_i
=
ci
->
parts
;
const
struct
part
*
restrict
parts_j
=
cj
->
parts
;
double
loc
[
3
];
...
...
This diff is collapsed.
Click to expand it.
src/runner_doiact_vec.c
+
21
−
25
View file @
0b0fb47c
...
...
@@ -1002,14 +1002,12 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
first_pi
=
min
(
first_pi
,
max_index_j
[
0
]);
/* Read the needed particles into the two caches. */
int
first_pi_align
=
first_pi
;
int
last_pj_align
=
last_pj
;
cache_read_two_partial_cells_sorted
(
ci
,
cj
,
ci_cache
,
cj_cache
,
sort_i
,
sort_j
,
shift
,
&
first_pi
_align
,
&
last_pj
_align
);
sort_j
,
shift
,
&
first_pi
,
&
last_pj
);
/* Get the number of particles read into the ci cache. */
int
ci_cache_count
=
count_i
-
first_pi
_align
;
int
ci_cache_count
=
count_i
-
first_pi
;
if
(
active_ci
)
{
...
...
@@ -1021,7 +1019,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
if
(
!
part_is_active_no_debug
(
pi
,
max_active_bin
))
continue
;
/* Set the cache index. */
int
ci_cache_idx
=
pid
-
first_pi
_align
;
int
ci_cache_idx
=
pid
-
first_pi
;
/* Skip this particle if no particle in cj is within range of it. */
const
float
hi
=
ci_cache
->
h
[
ci_cache_idx
];
...
...
@@ -1071,7 +1069,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
if
(
exit_iteration_align
+
pad
<=
last_pj
_align
+
1
)
if
(
exit_iteration_align
+
pad
<=
last_pj
+
1
)
exit_iteration_align
+=
pad
;
}
...
...
@@ -1087,9 +1085,9 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
if
(
cj_cache_idx
%
VEC_SIZE
!=
0
||
cj_cache_idx
<
0
||
cj_cache_idx
+
(
VEC_SIZE
-
1
)
>
(
last_pj
_align
+
1
+
VEC_SIZE
))
{
error
(
"Unaligned read!!! cj_cache_idx=%d, last_pj
_align
=%d"
,
cj_cache_idx
,
last_pj
_align
);
cj_cache_idx
+
(
VEC_SIZE
-
1
)
>
(
last_pj
+
1
+
VEC_SIZE
))
{
error
(
"Unaligned read!!! cj_cache_idx=%d, last_pj=%d"
,
cj_cache_idx
,
last_pj
);
}
#endif
...
...
@@ -1198,7 +1196,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
vector
pix
,
piy
,
piz
;
/* Convert exit iteration to cache indices. */
int
exit_iteration_align
=
exit_iteration
-
first_pi
_align
;
int
exit_iteration_align
=
exit_iteration
-
first_pi
;
/* Pad the exit iteration align so cache reads are aligned. */
int
rem
=
exit_iteration_align
%
VEC_SIZE
;
...
...
@@ -1214,11 +1212,11 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
if
(
ci_cache_idx
%
VEC_SIZE
!=
0
||
ci_cache_idx
<
0
||
ci_cache_idx
+
(
VEC_SIZE
-
1
)
>
(
count_i
-
first_pi
_align
+
VEC_SIZE
))
{
(
count_i
-
first_pi
+
VEC_SIZE
))
{
error
(
"Unaligned read!!! ci_cache_idx=%d, first_pi
_align
=%d, "
"Unaligned read!!! ci_cache_idx=%d, first_pi=%d, "
"count_i=%d"
,
ci_cache_idx
,
first_pi
_align
,
count_i
);
ci_cache_idx
,
first_pi
,
count_i
);
}
#endif
...
...
@@ -1387,14 +1385,12 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
first_pi
=
min
(
first_pi
,
max_index_j
[
0
]);
/* Read the needed particles into the two caches. */
int
first_pi_align
=
first_pi
;
int
last_pj_align
=
last_pj
;
cache_read_two_partial_cells_sorted_force
(
ci
,
cj
,
ci_cache
,
cj_cache
,
sort_i
,
sort_j
,
shift
,
&
first_pi
_align
,
&
last_pj
_align
);
sort_j
,
shift
,
&
first_pi
,
&
last_pj
);
/* Get the number of particles read into the ci cache. */
int
ci_cache_count
=
count_i
-
first_pi
_align
;
int
ci_cache_count
=
count_i
-
first_pi
;
if
(
active_ci
)
{
...
...
@@ -1406,7 +1402,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
if
(
!
part_is_active
(
pi
,
e
))
continue
;
/* Set the cache index. */
int
ci_cache_idx
=
pid
-
first_pi
_align
;
int
ci_cache_idx
=
pid
-
first_pi
;
/* Skip this particle if no particle in cj is within range of it. */
const
float
hi
=
ci_cache
->
h
[
ci_cache_idx
];
...
...
@@ -1459,7 +1455,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
if
(
exit_iteration_align
+
pad
<=
last_pj
_align
+
1
)
if
(
exit_iteration_align
+
pad
<=
last_pj
+
1
)
exit_iteration_align
+=
pad
;
}
...
...
@@ -1475,9 +1471,9 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
if
(
cj_cache_idx
%
VEC_SIZE
!=
0
||
cj_cache_idx
<
0
||
cj_cache_idx
+
(
VEC_SIZE
-
1
)
>
(
last_pj
_align
+
1
+
VEC_SIZE
))
{
error
(
"Unaligned read!!! cj_cache_idx=%d, last_pj
_align
=%d"
,
cj_cache_idx
,
last_pj
_align
);
cj_cache_idx
+
(
VEC_SIZE
-
1
)
>
(
last_pj
+
1
+
VEC_SIZE
))
{
error
(
"Unaligned read!!! cj_cache_idx=%d, last_pj=%d"
,
cj_cache_idx
,
last_pj
);
}
#endif
...
...
@@ -1600,7 +1596,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
entropy_dtSum
.
v
=
vec_setzero
();
/* Convert exit iteration to cache indices. */
int
exit_iteration_align
=
exit_iteration
-
first_pi
_align
;
int
exit_iteration_align
=
exit_iteration
-
first_pi
;
/* Pad the exit iteration align so cache reads are aligned. */
int
rem
=
exit_iteration_align
%
VEC_SIZE
;
...
...
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