Closed wvlothuizen closed 3 years ago
The src/scheduler.h consists of a class and a set of global functions. Only callers of the methods in the class are those global functions and functions internal to the mapper. Those called can be made public and specified in a class specification and left in a src/scheduler.h header. The implementations can be isolated in a src/scheduler.cc file. Of the set of global functions, those called from outside can be specified in the header. The code can be in the .cc file.
The hardest is to determine those methods of the class that are called. And then to compose the src/scheduler.cc file.
The split of current .h files into .h and .cc files is part of the modularization cleanup phase.
I see two possible ways to proceed:
What's your preference, or do you see other options?
See (status of) #364, I figured I could just split up the cleanup phase. I'm far from done cleaning everything up, but this is a start, and includes all header/source file fixes. The only thing I didn't look at yet is the CC backend, it's probably better to wait with that until changes thus far have been merged.
Pretty sure this should be solved via #364, otherwise reopen.
While working on PR #360 it was found that a prior adaptation to the CC backend to call the new scheduler actually wasn't working: the compile options in place never invoke the new code path in https://github.com/QE-Lab/OpenQL/blob/develop/src/arch/cc/eqasm_backend_cc.cc#L32 (i.e. both OPT_CC_SCHEDULE_KERNEL_H and OPT_CC_SCHEDULE_RC are undefined/false).
After solving this, it was found that the functions schedule() and rcschedule() in scheduler.h were defined as static, and thus not callable from a different compilation unit. Removing the 'static' doesn't work, because you then end up with duplicate symbols as exemplified by https://github.com/QE-Lab/OpenQL/pull/360/checks?check_run_id=1259285536
A quick look at the code seems to show that continuing in this direction won't work: if we move schedule() and cschedule() to a .cc file, the same needs to be done for the functions they call (schedule_kernel, rcschedule_kernel) and the class they use (Scheduler), or said otherwise: the whole file, and that's out of scope of PR #360.
Are there any plans on finishing the splitoff into .h and .cc files that was partially done?