What does "Invalid scope 'function' to arbb_end_loop: invalid control pairs" mean?

What does "Invalid scope 'function' to arbb_end_loop: invalid control pairs" mean?

I get the following error when I run at optimization level O2 or O3, the code works fine at O0.

Error: Caught unexpected ArBB::Exception.
Invalid scope 'function' to arbb_end_loop: invalid control pairs

What does this mean?
Thanks,
Mike

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Mike,

This error means there is something wrong with an ArBB loop. For example, no loop statement is being defined within a loop, or the loop is malformed. It will be helpful if you can post here the code snippet that causes this error.

Thanks,
Zhang

The code is attached.
The error occurs on line 366.
Thanks,
Mike

Adjuntos: 

AdjuntoTamaño
Descargar AOBenchArBB.cpp11.46 KB

Mike,

Thanks for the code. Although this error appears to occur on line 366, related to the _for loop, it is actually caused by some other problem in your code. On line 245, there is a "return" statement inside a _if branch. A "return" inside an ArBB control flow is not supported at this time. A workaround is to simply re-structure the _if to avoid the return statement:

void
ray_plane_intersect(Isect *isect, const Ray *ray,  Plane *plane)
{

	f32 d, v, t;
	d = -vdot(&(plane->p), &(plane->n));
	v = vdot(&(ray->dir), &(plane->n));

	/* This "return" should be avoided.
	_if (abs(v) < 1.0e-17f) { return; } _end_if;
	*/

	_if (abs(v) >= 1.0e-17f) {
		t = -(vdot(&(ray->org), &(plane->n)) + d) / v;

		_if ((t > 0.0f) && (t < isect->t)) 
		{
			isect->t = t;
			isect->hit = 1;

			isect->p.x = ray->org.x + ray->dir.x * t;
			isect->p.y = ray->org.y + ray->dir.y * t;
			isect->p.z = ray->org.z + ray->dir.z * t;

			isect->n.x = plane->n.x;
			isect->n.y = plane->n.y;
			isect->n.z = plane->n.z;
		} _end_if;
	} _end_if;
}

Not allowing a return statement inside a control flow is restrictive to programers. ArBB will address this in future releases.

Another potential issue in your code is the use of C pointers to ArBB variables. Intel ArBB operates in a data space that is isolated from the native (C/C++) data space. According to the User Guide, Intel ArBB objects are not accessible via C/C++ pointers. To be safe, you should pass by value or pass by reference the arguments to ArBB functions.

One thing that Intel ArBB should improve is to emit more relevant error messages for this type of misuses.

Thanks

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya