Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • pystencils pystencils
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 18
    • Issues 18
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pycodegen
  • pystencilspystencils
  • Merge requests
  • !5

Add global_declarations to cbackend

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Stephan Seitz requested to merge seitz/pystencils:global-declarations into master Jul 08, 2019
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 2

This enables astnodes.Nodes to have a member required_global_declarations by which they can specify a global declaration required for their usage.

In the test, I added a AST-Node Bogus which requires a global declaration. The global declaration can define symbols required in the kernel that will then not appear in the kernel parameters

// Declaration would go here

FUNC_PREFIX void kernel(double * RESTRICT const _data_x, double * RESTRICT const _data_y, double * RESTRICT _data_z, int64_t const _size_1, int64_t const _stride_z_0, int64_t const _stride_z_1)
{
   for (int ctr_0 = 0; ctr_0 < _size_x_0; ctr_0 += 1)
   {
      double * RESTRICT _data_z_00 = _data_z + _stride_z_0*ctr_0;
      double * RESTRICT const _data_y_00 = _data_y + _stride_y_0*ctr_0;
      double * RESTRICT const _data_x_00 = _data_x + _stride_x_0*ctr_0;
      for (int ctr_1 = 0; ctr_1 < _size_x_1; ctr_1 += 1)
      {
         _data_z_00[_stride_z_1*ctr_1] = log(_data_x_00[_stride_x_1*ctr_1]*_data_y_00[_stride_y_1*ctr_1])*_data_y_00[_stride_y_1*ctr_1];
      }
   }
   // Bogus would go here
}

I used this code for my CudaBackend (instead of CBackend) to enable the forward declaration of textures and constant memory.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: global-declarations