@@ -122,16 +122,19 @@ static void writeToFile(std::string Filename, std::string Content) {
122122}
123123
124124// Describes scope covered by each entry in the module-kernel map populated by
125- // the function below .
125+ // the collectKernelModuleMap function .
126126enum KernelMapEntryScope {
127127 Scope_PerKernel, // one entry per kernel
128128 Scope_PerModule, // one entry per module
129129 Scope_Global // single entry in the map for all kernels
130130};
131131
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.
135138static void collectKernelModuleMap (
136139 Module &M, std::map<StringRef, std::vector<Function *>> &ResKernelModuleMap,
137140 KernelMapEntryScope EntryScope) {
@@ -145,6 +148,9 @@ static void collectKernelModuleMap(
145148 case Scope_PerModule: {
146149 constexpr char ATTR_SYCL_MODULE_ID[] = " sycl-module-id" ;
147150
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.
148154 if (!F.hasFnAttribute (ATTR_SYCL_MODULE_ID))
149155 error (" no '" + Twine (ATTR_SYCL_MODULE_ID) +
150156 " ' attribute in kernel '" + F.getName () +
0 commit comments