@@ -89,8 +89,8 @@ struct SharedMemorySmartStackTy {
89
89
// / Compute the size of the storage space reserved for a thread.
90
90
uint32_t computeThreadStorageTotal () {
91
91
uint32_t NumLanesInBlock = mapping::getNumberOfThreadsInBlock ();
92
- return utils::alignDown (( state::SharedScratchpadSize / NumLanesInBlock) ,
93
- allocator::ALIGNMENT);
92
+ return __builtin_align_down ( state::SharedScratchpadSize / NumLanesInBlock,
93
+ allocator::ALIGNMENT);
94
94
}
95
95
96
96
// / Return the top address of the warp data stack, that is the first address
@@ -121,7 +121,7 @@ void *SharedMemorySmartStackTy::push(uint64_t Bytes) {
121
121
// First align the number of requested bytes.
122
122
// / FIXME: The stack shouldn't require worst-case padding. Alignment needs to
123
123
// / be passed in as an argument and the stack rewritten to support it.
124
- uint64_t AlignedBytes = utils::alignPtr (Bytes, allocator::ALIGNMENT);
124
+ uint64_t AlignedBytes = __builtin_align_up (Bytes, allocator::ALIGNMENT);
125
125
126
126
uint32_t StorageTotal = computeThreadStorageTotal ();
127
127
@@ -149,7 +149,7 @@ void *SharedMemorySmartStackTy::push(uint64_t Bytes) {
149
149
}
150
150
151
151
void SharedMemorySmartStackTy::pop (void *Ptr , uint64_t Bytes) {
152
- uint64_t AlignedBytes = utils::alignPtr (Bytes, allocator::ALIGNMENT);
152
+ uint64_t AlignedBytes = __builtin_align_up (Bytes, allocator::ALIGNMENT);
153
153
if (utils::isSharedMemPtr (Ptr )) {
154
154
int TId = mapping::getThreadIdInBlock ();
155
155
Usage[TId] -= AlignedBytes;
0 commit comments