Skip to content

Commit

Permalink
Added profiler
Browse files Browse the repository at this point in the history
mikex86 committed Sep 11, 2024
1 parent 6d8e212 commit 4bef39a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion driverapi/src/librecuda.cpp
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define GPU_FIFO_AREA_SIZE 0x200000

@@ -241,7 +242,12 @@ static inline NvU64 maxOf(NvU64 a, NvU64 b) {
}

NvU64 bump_alloc_virtual_addr(LibreCUcontext ctx, size_t size, NvU32 alignment = 4 << 10) {
NvU64 va_address = ceilDiv(ctx->uvm_vaddr, alignment) * alignment;
NvU64 va_address = ctx->uvm_vaddr;
NvU64 slack = va_address % alignment;
if (slack != 0) {
va_address += (alignment - slack);
}
assert(va_address % alignment == 0);
ctx->uvm_vaddr = va_address + size;
return va_address;
}

1 comment on commit 4bef39a

@mikex86
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong commit message

Please sign in to comment.