Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libclfft
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maximillian Bensch
libclfft
Commits
bd31f59c
Commit
bd31f59c
authored
5 years ago
by
Maximillian Bensch
Browse files
Options
Downloads
Patches
Plain Diff
Memdebug: count memory allocs
parent
0edfa5d2
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/clFFT.h
+2
-0
2 additions, 0 deletions
include/clFFT.h
src/fft_execute.cpp
+6
-3
6 additions, 3 deletions
src/fft_execute.cpp
src/fft_internal.h
+3
-0
3 additions, 0 deletions
src/fft_internal.h
src/fft_setup.cpp
+22
-2
22 additions, 2 deletions
src/fft_setup.cpp
with
33 additions
and
5 deletions
include/clFFT.h
+
2
−
0
View file @
bd31f59c
...
...
@@ -194,6 +194,8 @@ cl_int clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem arra
void
clFFT_DumpPlan
(
clFFT_Plan
plan
,
FILE
*
file
);
size_t
getMallocSize
(
void
);
#ifdef __cplusplus
}
#endif
...
...
This diff is collapsed.
Click to expand it.
src/fft_execute.cpp
+
6
−
3
View file @
bd31f59c
...
...
@@ -79,9 +79,10 @@ allocateTemporaryBufferInterleaved(cl_fft_plan *plan, cl_uint batchSize)
size_t
tmpLength
=
plan
->
n
.
x
*
plan
->
n
.
y
*
plan
->
n
.
z
*
batchSize
*
2
*
sizeof
(
cl_float
);
if
(
plan
->
tempmemobj
)
mallocsize
-=
sizeof
(
plan
->
tempmemobj
);
clReleaseMemObject
(
plan
->
tempmemobj
);
plan
->
tempmemobj
=
cl
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_WRITE
,
tmpLength
,
NULL
,
&
err
);
plan
->
tempmemobj
=
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_WRITE
,
tmpLength
,
NULL
,
&
err
);
}
return
err
;
}
...
...
@@ -97,13 +98,15 @@ allocateTemporaryBufferPlannar(cl_fft_plan *plan, cl_uint batchSize)
size_t
tmpLength
=
plan
->
n
.
x
*
plan
->
n
.
y
*
plan
->
n
.
z
*
batchSize
*
sizeof
(
cl_float
);
if
(
plan
->
tempmemobj_real
)
mallocsize
-=
sizeof
(
plan
->
tempmemobj_real
);
clReleaseMemObject
(
plan
->
tempmemobj_real
);
if
(
plan
->
tempmemobj_imag
)
mallocsize
-=
sizeof
(
plan
->
tempmemobj_imag
);
clReleaseMemObject
(
plan
->
tempmemobj_imag
);
plan
->
tempmemobj_real
=
cl
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_WRITE
,
tmpLength
,
NULL
,
&
err
);
plan
->
tempmemobj_imag
=
cl
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_WRITE
,
tmpLength
,
NULL
,
&
terr
);
plan
->
tempmemobj_real
=
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_WRITE
,
tmpLength
,
NULL
,
&
err
);
plan
->
tempmemobj_imag
=
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_WRITE
,
tmpLength
,
NULL
,
&
terr
);
err
|=
terr
;
}
return
err
;
...
...
This diff is collapsed.
Click to expand it.
src/fft_internal.h
+
3
−
0
View file @
bd31f59c
...
...
@@ -70,6 +70,7 @@
using
namespace
std
;
extern
size_t
mallocsize
;
typedef
enum
kernel_dir_t
{
cl_fft_kernel_x
,
...
...
@@ -186,4 +187,6 @@ typedef struct
void
FFT1D
(
cl_fft_plan
*
plan
,
cl_fft_kernel_dir
dir
);
cl_mem
CreateBuffer
(
cl_context
context
,
cl_mem_flags
flags
,
size_t
size
,
void
*
host_ptr
,
cl_int
*
errcode_ret
);
#endif
This diff is collapsed.
Click to expand it.
src/fft_setup.cpp
+
22
−
2
View file @
bd31f59c
...
...
@@ -76,6 +76,8 @@ using namespace std;
extern
void
getKernelWorkDimensions
(
cl_fft_plan
*
plan
,
cl_fft_kernel_info
*
kernelInfo
,
cl_int
*
batchSize
,
size_t
*
gWorkItems
,
size_t
*
lWorkItems
);
size_t
mallocsize
=
0
;
static
void
getBlockConfigAndKernelString
(
cl_fft_plan
*
plan
)
{
...
...
@@ -162,27 +164,32 @@ destroy_plan(cl_fft_plan *Plan)
}
if
(
Plan
->
tempmemobj
)
{
mallocsize
-=
sizeof
(
Plan
->
tempmemobj
);
clReleaseMemObject
(
Plan
->
tempmemobj
);
Plan
->
tempmemobj
=
NULL
;
}
if
(
Plan
->
tempmemobj_real
)
{
mallocsize
-=
sizeof
(
Plan
->
tempmemobj_real
);
clReleaseMemObject
(
Plan
->
tempmemobj_real
);
Plan
->
tempmemobj_real
=
NULL
;
}
if
(
Plan
->
tempmemobj_imag
)
{
mallocsize
-=
sizeof
(
Plan
->
tempmemobj_imag
);
clReleaseMemObject
(
Plan
->
tempmemobj_imag
);
Plan
->
tempmemobj_imag
=
NULL
;
}
if
(
Plan
->
cossin_LUT_d1
)
{
mallocsize
-=
sizeof
(
Plan
->
cossin_LUT_d1
);
clReleaseMemObject
(
Plan
->
cossin_LUT_d1
);
}
if
(
Plan
->
cossin_LUT_d2
)
{
mallocsize
-=
sizeof
(
Plan
->
cossin_LUT_d2
);
clReleaseMemObject
(
Plan
->
cossin_LUT_d2
);
}
...
...
@@ -310,7 +317,7 @@ int precomputeSinCosLUTs(cl_fft_plan * plan,cl_int *error_code) {
tmpLUT_cossin1
[
i
*
2
]
=
(
float
)
cos
(
PI2
*
(
float
)
i
/
(
float
)
N
);
tmpLUT_cossin1
[
i
*
2
+
1
]
=
(
float
)
sin
(
PI2
*
(
float
)
i
/
(
float
)
N
);
}
plan
->
cossin_LUT_d1
=
cl
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_ONLY
|
CL_MEM_COPY_HOST_PTR
,
plan
->
N1
*
2
*
sizeof
(
float
),
tmpLUT_cossin1
,
&
err
);
plan
->
cossin_LUT_d1
=
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_ONLY
|
CL_MEM_COPY_HOST_PTR
,
plan
->
N1
*
2
*
sizeof
(
float
),
tmpLUT_cossin1
,
&
err
);
if
(
err
!=
CL_SUCCESS
)
{
...
...
@@ -327,7 +334,7 @@ int precomputeSinCosLUTs(cl_fft_plan * plan,cl_int *error_code) {
tmpLUT_cossin2
[
2
*
i
]
=
(
float
)
cos
(
PI2
*
(
float
)
i
/
(
float
)
plan
->
N2
);
tmpLUT_cossin2
[
2
*
i
+
1
]
=
(
float
)
sin
(
PI2
*
(
float
)
i
/
(
float
)
plan
->
N2
);
}
plan
->
cossin_LUT_d2
=
cl
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_ONLY
|
CL_MEM_COPY_HOST_PTR
,
plan
->
N2
*
2
*
sizeof
(
float
),
tmpLUT_cossin2
,
&
err
);
plan
->
cossin_LUT_d2
=
CreateBuffer
(
plan
->
context
,
CL_MEM_READ_ONLY
|
CL_MEM_COPY_HOST_PTR
,
plan
->
N2
*
2
*
sizeof
(
float
),
tmpLUT_cossin2
,
&
err
);
if
(
err
!=
CL_SUCCESS
)
{
if
(
error_code
)
...
...
@@ -526,3 +533,16 @@ void clFFT_DumpPlan( clFFT_Plan Plan, FILE *file)
}
fprintf
(
out
,
"%s
\n
"
,
plan
->
kernel_string
->
c_str
());
}
cl_mem
CreateBuffer
(
cl_context
context
,
cl_mem_flags
flags
,
size_t
size
,
void
*
host_ptr
,
cl_int
*
errcode_ret
)
{
cl_mem
ret
=
clCreateBuffer
(
context
,
flags
,
size
,
host_ptr
,
errcode_ret
);
mallocsize
+=
size
;
return
ret
;
}
size_t
getMallocSize
(
void
)
{
return
mallocsize
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment