-
Notifications
You must be signed in to change notification settings - Fork 3
/
executionSequence.cpp
68 lines (58 loc) · 1.97 KB
/
executionSequence.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdint>
#include <set>
#include "global.h"
#include "prefetch.h"
#ifdef ANALYSIS
#include "analysis.h"
#endif
void executionSequenceCudnnCublasApi(const char *name) {
DEBUG("executionSequenceCudnnCublasApi, name = %s\n", name);
#ifdef ANALYSIS
analysisDumpCudnnCublasApiName(name);
#endif
}
void executionSequenceCudaKernel(const char *name) {
DEBUG("executionSequenceCudaKernel, name = %s\n", name);
#ifdef ANALYSIS
analysisDumpCudaKernelName(name);
#endif
}
void executionSequenceCudnnCublasAccessBlock(const void *ptr, const size_t size, bool fromCudnn) {
if ((uint64_t) ptr == (uint64_t) 0 || (uint64_t) size == (uint64_t) 0) {
return;
}
DEBUG("Dependency from CUDNN/CUBLAS: ptr = %llx, size = %llu\n", (unsigned long long int) ptr, (unsigned long long int) size);
if (fromCudnn) {
if (controlVariables.hasCudnn == false) {
controlVariables.hasCudnn = true;
updateGpuMemoryFactor();
}
}
if (controlVariables.hasFrameworkActive) {
return;
}
pushToPrefetchCache((uint64_t) ptr, (uint64_t) size);
}
void executionSequenceCudaAccessBlock(const void *ptr, const size_t size) {
if ((uint64_t) ptr == (uint64_t) 0 || (uint64_t) size == (uint64_t) 0) {
return;
}
DEBUG("Dependency from CUDA: ptr = %llx, size = %llu\n", (unsigned long long int) ptr, (unsigned long long int) size);
if (controlVariables.hasFrameworkActive) {
return;
}
pushToPrefetchCache((uint64_t) ptr, (uint64_t) size);
}
void executionSequenceFrameworkAccessBlock(const void *ptr, const size_t size) {
if ((uint64_t) ptr == (uint64_t) 0 || (uint64_t) size == (uint64_t) 0) {
return;
}
DEBUG("Dependency from Framework: ptr = %llx, size = %llu\n", (unsigned long long int) ptr, (unsigned long long int) size);
pushToPrefetchCache((uint64_t) ptr, (uint64_t) size);
}
void executionSequenceRemoveBlock(uint64_t ptr, uint64_t size) {
invalidateMemoryBlockInPrefetchCache(ptr, size);
}