HomePhabricator

[OpenCL] Clean up and add missing fields for block struct

Authored by yaxunl on Oct 4 2017, 1:32 PM.

Description

[OpenCL] Clean up and add missing fields for block struct

Currently block is translated to a structure equivalent to

struct Block {

void *isa;
int flags;
int reserved;
void *invoke;
void *descriptor;

};
Except invoke, which is the pointer to the block invoke function,
all other fields are useless for OpenCL, which clutter the IR and
also waste memory since the block struct is passed to the block
invoke function as argument.

On the other hand, the size and alignment of the block struct is
not stored in the struct, which causes difficulty to implement
__enqueue_kernel as library function, since the library function
needs to know the size and alignment of the argument which needs
to be passed to the kernel.

This patch removes the useless fields from the block struct and adds
size and align fields. The equivalent block struct will become

struct Block {

int size;
int align;
generic void *invoke;

/* custom fields */
};
It also changes the pointer to the invoke function to be
a generic pointer since the address space of a function
may not be private on certain targets.

Differential Revision: https://reviews.llvm.org/D37822

llvm-svn: 314932

Details

Committed
yaxunlOct 4 2017, 1:32 PM
Differential Revision
D37822: [OpenCL] Clean up and add missing fields for block struct
Parents
rG8c0ff9508da5: Bring r314809 back.
Branches
Unknown
Tags
Unknown