@@ -122,16 +122,19 @@ static void writeToFile(std::string Filename, std::string Content) {
122
122
}
123
123
124
124
// Describes scope covered by each entry in the module-kernel map populated by
125
- // the function below .
125
+ // the collectKernelModuleMap function .
126
126
enum KernelMapEntryScope {
127
127
Scope_PerKernel, // one entry per kernel
128
128
Scope_PerModule, // one entry per module
129
129
Scope_Global // single entry in the map for all kernels
130
130
};
131
131
132
- // Output parameter ResKernelModuleMap is a map containing groups of kernels
133
- // with same values of the sycl-module-id attribute.
134
- // The function fills ResKernelModuleMap using input module M.
132
+ // This function decides how kernels of the input module M will be distributed
133
+ // ("split") into multiple modules based on the command options and IR
134
+ // attributes. The desision is recorded in the output map parameter
135
+ // ResKernelModuleMap which maps some key to a group of kernels. Each such group
136
+ // along with IR it depends on (globals, functions from its call graph,...) will
137
+ // constitute a separate module.
135
138
static void collectKernelModuleMap (
136
139
Module &M, std::map<StringRef, std::vector<Function *>> &ResKernelModuleMap,
137
140
KernelMapEntryScope EntryScope) {
@@ -145,6 +148,9 @@ static void collectKernelModuleMap(
145
148
case Scope_PerModule: {
146
149
constexpr char ATTR_SYCL_MODULE_ID[] = " sycl-module-id" ;
147
150
151
+ // TODO It may make sense to group all kernels w/o the attribute into
152
+ // a separate module rather than issuing an error. Should probably be
153
+ // controlled by an option.
148
154
if (!F.hasFnAttribute (ATTR_SYCL_MODULE_ID))
149
155
error (" no '" + Twine (ATTR_SYCL_MODULE_ID) +
150
156
" ' attribute in kernel '" + F.getName () +
0 commit comments