We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d8e212 commit 4bef39aCopy full SHA for 4bef39a
driverapi/src/librecuda.cpp
@@ -41,6 +41,7 @@
41
#include <set>
42
#include <unordered_map>
43
#include <unordered_set>
44
+#include <cassert>
45
46
#define GPU_FIFO_AREA_SIZE 0x200000
47
@@ -241,7 +242,12 @@ static inline NvU64 maxOf(NvU64 a, NvU64 b) {
241
242
}
243
244
NvU64 bump_alloc_virtual_addr(LibreCUcontext ctx, size_t size, NvU32 alignment = 4 << 10) {
- NvU64 va_address = ceilDiv(ctx->uvm_vaddr, alignment) * alignment;
245
+ NvU64 va_address = ctx->uvm_vaddr;
246
+ NvU64 slack = va_address % alignment;
247
+ if (slack != 0) {
248
+ va_address += (alignment - slack);
249
+ }
250
+ assert(va_address % alignment == 0);
251
ctx->uvm_vaddr = va_address + size;
252
return va_address;
253
0 commit comments