Skip to content

Commit 70de6dd

Browse files
committed
fix kernelDurationsBuf size to account for discarded first element
1 parent 3d86bcb commit 70de6dd

File tree

6 files changed

+12
-19
lines changed

6 files changed

+12
-19
lines changed

external/Actor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ SYCL_EXTERNAL void Actor::setSeed(uint newSeed) { seed = newSeed; }
8585

8686
SYCL_EXTERNAL void Actor::setForce(float newForce) { force = newForce; }
8787

88-
SYCL_EXTERNAL void
89-
Actor::checkAtDestination(sycl::float4 destination,
90-
int pathSize) {
88+
SYCL_EXTERNAL void Actor::checkAtDestination(sycl::float4 destination,
89+
int pathSize) {
9190
// Destinations are defined as rectangular regions
9291
if (pos[0] >= destination[0] && pos[0] <= destination[2] &&
9392
pos[1] >= destination[1] && pos[1] <= destination[3]) {

external/Actor.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class Actor {
7676
SYCL_EXTERNAL void setSeed(uint newSeed);
7777
SYCL_EXTERNAL void setForce(float newForce);
7878

79-
SYCL_EXTERNAL void
80-
checkAtDestination(sycl::float4 destination, int pathSize);
79+
SYCL_EXTERNAL void checkAtDestination(sycl::float4 destination,
80+
int pathSize);
8181
};
8282

8383
#endif

external/Path.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525

2626
#include "Path.hpp"
2727

28-
Path::Path(
29-
int pId,
30-
std::array<sycl::float4, PATH_ALLOCATION_SIZE> pCheckpoints,
31-
int pPathSize)
28+
Path::Path(int pId, std::array<sycl::float4, PATH_ALLOCATION_SIZE> pCheckpoints,
29+
int pPathSize)
3230
: id(pId), checkpoints(pCheckpoints), pathSize(pPathSize) {}
3331

3432
SYCL_EXTERNAL int Path::getId() const { return id; }
@@ -43,7 +41,6 @@ SYCL_EXTERNAL int Path::getPathSize() const { return pathSize; }
4341
void Path::setId(int newId) { id = newId; }
4442

4543
void Path::setCheckpoints(
46-
std::array<sycl::float4, PATH_ALLOCATION_SIZE>
47-
newCheckpoints) {
44+
std::array<sycl::float4, PATH_ALLOCATION_SIZE> newCheckpoints) {
4845
checkpoints = newCheckpoints;
4946
}

external/Path.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ class Path {
4242
int pathSize;
4343

4444
public:
45-
Path(int pId,
46-
std::array<sycl::float4, PATH_ALLOCATION_SIZE>
47-
pCheckpoints,
45+
Path(int pId, std::array<sycl::float4, PATH_ALLOCATION_SIZE> pCheckpoints,
4846
int pPathSize);
4947

5048
SYCL_EXTERNAL int getId() const;
@@ -53,9 +51,8 @@ class Path {
5351
SYCL_EXTERNAL int getPathSize() const;
5452

5553
void setId(int newId);
56-
void
57-
setCheckpoints(std::array<sycl::float4, PATH_ALLOCATION_SIZE>
58-
newCheckpoints);
54+
void setCheckpoints(
55+
std::array<sycl::float4, PATH_ALLOCATION_SIZE> newCheckpoints);
5956
};
6057

6158
#endif

external/Stats.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void finalizeStats(sycl::queue myQueue, std::vector<float> averageForces,
116116
auto kernelDurationsForOutput = kernelDurations;
117117
// Discard first kernel time to prevent skewed results
118118
auto kernelDurationsBuf = sycl::buffer<int>(kernelDurations.data() + 1,
119-
kernelDurations.size());
119+
kernelDurations.size() - 1);
120120

121121
// Calculate average kernel duration
122122
myQueue.submit([&](sycl::handler &cgh) {

external/VectorMaths.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* Description:
2222
* Operator overloading for common operators on vectors
23-
*
23+
*
2424
**************************************************************************/
2525

2626
#ifndef VectorMaths_hpp

0 commit comments

Comments
 (0)