-
Notifications
You must be signed in to change notification settings - Fork 196
Description
Scheduling directives in the command line tool are parsed in a way that treats spaces as equivalent to commas. It uses std::stringstream, which splits the string up on whitespace, and it replaces parentheses and commas with spaces to enable that. This is not the biggest problem. Though it does mean that a lot of things are parsed the same way:
$ taco 'A(i,j) = B(i,j) * 5' -s='reorder(j,i)'
$ taco 'A(i,j) = B(i,j) * 5' -s='reorder(j i)'
$ taco 'A(i,j) = B(i,j) * 5' -s='reorder(j i'
$ taco 'A(i,j) = B(i,j) * 5' -s='reorder j i'
$ taco 'A(i,j) = B(i,j) * 5' -s='reorder(j)i'
$ taco 'A(i,j) = B(i,j) * 5' -s='reorder,j(i)'However, the precompute directive needs more careful parsing. It takes an index expression as a parameter. If that index expression contains a space, it gets chopped in half and only the first half is parsed.
Example:
taco 'A(i,j) = B(i,j) * 5' -s='precompute(B(i,j)*5,j,j)' > code.c
taco 'A(i,j) = B(i,j) * 5' -s='precompute(B(i, j)*5,j,j)' > code.c
terminate called after throwing an instance of 'taco::TacoException'
what(): Error at /home/infinoid/workspace/taco/git/tools/taco.cpp:222 in operator():
Index variable 'j)*5' not defined in statement forall(i, forall(j, A(i,j) = B(i,j) * 5))
AbortedThe first one worked. The second one failed. I had to fix it so that the error was reported properly. Previously the error was:
terminate called after throwing an instance of 'char const*'
Aborted
The parser needs to be smarter about splitting up parameter strings on the right boundaries. I am working on a patch for this.