g++ and omp simd virtual functions

marcin.krotkiewski marcin.krotkiewski@gmail.com
Wed Jan 10 10:37:00 GMT 2018


Dear all,

I am having little success with making g++ use vector (aka omp simd) 
calls to virtual functions. I have a base class

class vecclass_v {
  public:

#pragma omp declare simd simdlen(4)
   virtual double vectest_ob(double v1, double v2) = 0;
}

and a derived class

class vecclass : public vecclass_v {
  public:

#pragma omp declare simd simdlen(4)
   double vectest_ob(double v1, double v2);
};

I can see that g++ correctly generates instances of vectorized functions 
for the derived class - they are present in the object file. But calling 
the virtual function is not resolved to a vectorized call, but uses the 
scalar member instance instead, e.g.,

vecclass_v *ob = [...]
ob->vectest_ob()

The Intel compiler does support vectorized virtual functions 
(https://software.intel.com/en-us/articles/virtual-vector-function-supported-in-intel-c-compiler-170). 
Does g++ support this?

Thanks!

Marcin



More information about the Gcc-help mailing list