Skip to content

[ICE] Vectorization compiler pass fails #12

Description

@IgWod

The following code:

#include <stdio.h>
#include <stdlib.h>
#include "../common/common.h"
#include "../common/sync.h"

void* sref;

int main() {
  struct timeval start;
  struct timeval end;

  int block_size = 1000;
  int array_size = 100000;
  int number_blocks = array_size / block_size;
  int number_streams = number_blocks;

  double s[number_streams] __attribute__((stream));
  sref = malloc(number_streams * sizeof(void*));
  memcpy(sref, s, number_streams * sizeof(void*));

  double input[array_size];
  double* inputref = input;

  for (int i = 0; i < array_size; i++) input[i] = 1.0;

  double output[array_size];
  double* outputref = output;

  gettimeofday(&start, NULL);

  for (int id = 0; id < number_blocks; id++) {
    double out[block_size];

    #pragma omp task output(sref[id] << out[block_size])
    {
      for (int i = 0; i < block_size; i++)
        out[i] = inputref[id * block_size + i];
    }
  }

  for (int id = 0; id < number_blocks; id++) {
    double in[block_size];

    #pragma omp task input(sref[id] >> in[block_size])
    {
      for (int i = 0; i < block_size; i++)
        outputref[id * block_size + i] = in[i];
    }
  }

  #pragma omp taskwait

  gettimeofday(&end, NULL);

  printf("%.5f\n", tdiff(&end, &start));

  free(sref);

  return 0;
}

Fails with:

for_task.c:8:5: internal compiler error: in vectorizable_store, at tree-vect-stmts.c:7142
    8 | int main() {
      |     ^~~~
0xc688a6 vectorizable_store
        ../../gcc/tree-vect-stmts.c:7141
0xc7308d vect_transform_stmt(_stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
        ../../gcc/tree-vect-stmts.c:9805
0xc90f2a vect_schedule_slp_instance
        ../../gcc/tree-vect-slp.c:4021
0xc9530d vect_schedule_slp(vec_info*)
        ../../gcc/tree-vect-slp.c:4095
0xc99127 vect_slp_bb(basic_block_def*)
        ../../gcc/tree-vect-slp.c:3049
0xc9b92a execute
        ../../gcc/tree-vectorizer.c:1306

This is a common problem with a workaround being a compiler flag -fno-tree-vectorize.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompilerCompiler related issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions