Skip to content

Commit 95ee950

Browse files
committed
ocl: fixed leaking event objects
- Makefile (acc_bench): introduced SANITIZE. - Test condition prior to calling function. - Check runtime state during setup. - Ensure valid data; avoid log(0). - Improved handling errors.
1 parent 0175815 commit 95ee950

File tree

5 files changed

+231
-155
lines changed

5 files changed

+231
-155
lines changed

src/acc/opencl/Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ HEADERONLY ?= 0
2424
STATIC ?= 1
2525
DEV ?= 0
2626

27+
# Kind of Clang/GCC based analysis:
28+
# leak, address, undefined, thread
29+
SANITIZE ?= $(NULL)
30+
2731
# Intel Compiler
2832
ICX := $(shell which icx 2>/dev/null)
2933
INTEL ?= $(if $(ICX),$(if $(filter-out 0,$(GNU)),0,2),0)
@@ -113,6 +117,14 @@ ifneq (0,$(DEV))
113117
#CFLAGS += -std=c99
114118
endif
115119

120+
ifneq (,$(SANITIZE))
121+
CXXFLAGS += -fsanitize=$(SANITIZE)
122+
CFLAGS += -fsanitize=$(SANITIZE)
123+
FCFLAGS += -fsanitize=$(SANITIZE)
124+
LDFLAGS += -fsanitize=$(SANITIZE)
125+
SYM = 1
126+
endif
127+
116128
ifneq (0,$(DBG))
117129
CPP_OPENCL_FLAGS += -C
118130
ifeq (,$(DBG))
@@ -125,7 +137,7 @@ ifneq (0,$(DBG))
125137
endif
126138
else
127139
CFLAGS += -O2 -DNDEBUG
128-
SYM := 0
140+
SYM ?= 0
129141
endif
130142
ifneq (0,$(SYM))
131143
CFLAGS += -g

0 commit comments

Comments
 (0)