Skip to content

Cannot handle non scoped loops #1

@ian-bertolacci

Description

@ian-bertolacci

The following:

#pragma omplc loopchain schedule( /* list of schedule directives */ )
{
  #pragma omplc for domain(0:N,0:N) \
    with (i,j) \
      write a { (i,j) }
  for( int i = 0; i < N; ++i )
    for( int j = 0; j < N; ++j )
      a[i][j] = f( i, j );

  #pragma omplc for domain(0:N,0:N) \
    with (i,j) \
      read a { (i,j) }, \
      write b { (i,j) }
  for( int i = 0; i < N; ++i )
    for( int j = 0; j < N; ++j )
      b[i][j] = g( a[i][j] );

}

produces the error

lctool: Cxx_Grammar.C:106801: SgStatementPtrList& SgBasicBlock::get_statements(): Assertion `this != NULL' failed.
Aborted (core dumped)

Fixed by changing the code to:

#pragma omplc loopchain schedule( /* list of schedule directives */ )
{
  #pragma omplc for domain(0:N,0:N) \
    with (i,j) \
      write a { (i,j) }
  for( int i = 0; i < N; ++i ){
    for( int j = 0; j < N; ++j ){
      a[i][j] = f( i, j );
    }
  }

  #pragma omplc for domain(0:N,0:N) \
    with (i,j) \
      read a { (i,j) }, \
      write b { (i,j) }
  for( int i = 0; i < N; ++i ){
    for( int j = 0; j < N; ++j ){
      b[i][j] = g( a[i][j] );
    }
  }

}

Verbose trace (-v 4):

-> Verbosity set to 4
2> Visiting Sage nodes to parse pragmas
2> Parsing pragma 'omplc loopchain schedule( )' at line 14 in file /home/ian/Research/LoopChainToolDemo/examples/grant.cpp
4> Pragma token 'omplc' recognized
3> Parsing loop-chain pragma ' loopchain schedule( )'
1> keyword loopchain captured
4> LOOP CHAIN
3> Added LoopChain attribute to node at line 15 in file /home/ian/Research/LoopChainToolDemo/examples/grant.cpp
2> Parsing pragma 'omplc for domain(0:N,0:N) with (i,j) write a { (i,j) }' at line 16 in file /home/ian/Research/LoopChainToolDemo/examples/grant.cpp
4> Pragma token 'omplc' recognized
3> Parsing loop-chain pragma ' for domain(0:N,0:N) with (i,j) write a { (i,j) }'
3> Found symbol: N
1> Creating a domain: 0, N
1> Created a domain
3> Found symbol: N
1> Creating a domain: 0, N
1> Created a domain
1> Appending a domain 11
1> Appended a domain 1
4> partial collection { (0, 0) }empty {  }
4> Partially creating Dataspace a
4> Created Dataspaces for LoopNest:
4> a: 
	Reads: {  }
	Writes: { (0, 0) }
1> Creating a Loop Nest
1> Setting the Loop Nest
1> LoopNest is complete
4> LOOP NEST
3> Added LoopChain attribute to node at line 19 in file /home/ian/Research/LoopChainToolDemo/examples/grant.cpp
2> Parsing pragma 'omplc for domain(0:N,0:N) with (i,j) read a { (i,j) }, write b { (i,j) }' at line 23 in file /home/ian/Research/LoopChainToolDemo/examples/grant.cpp
4> Pragma token 'omplc' recognized
3> Parsing loop-chain pragma ' for domain(0:N,0:N) with (i,j) read a { (i,j) }, write b { (i,j) }'
3> Found symbol: N
1> Creating a domain: 0, N
1> Created a domain
3> Found symbol: N
1> Creating a domain: 0, N
1> Created a domain
1> Appending a domain 11
1> Appended a domain 1
4> partial collection { (0, 0) }empty {  }
4> Partially creating Dataspace a
4> partial collection { (0, 0) }empty {  }
4> Partially creating Dataspace b
4> Created Dataspaces for LoopNest:
4> a: 
	Reads: { (0, 0) }
	Writes: {  }
4> b: 
	Reads: {  }
	Writes: { (0, 0) }
1> Creating a Loop Nest
1> Setting the Loop Nest
1> LoopNest is complete
4> LOOP NEST
3> Added LoopChain attribute to node at line 27 in file /home/ian/Research/LoopChainToolDemo/examples/grant.cpp
3> Found LC attribute
3> Found Nest
lctool: Cxx_Grammar.C:106801: SgStatementPtrList& SgBasicBlock::get_statements(): Assertion `this != NULL' failed.
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions