AnsweredAssumed Answered

glGetInteger64v(GL_TIMESTAMP, ...) still broken on Vega

Question asked by cameni on Oct 16, 2019
Latest reply on Oct 18, 2019 by dipak

In old drivers there was a bug in getting the current GPU time on Vega GPUs, as described also here:

glGetInteger64v(GL_TIMESTAMP, ...) broken on Vega 

 

This was fixed in later drivers, but the behavior is still not correct. Using the following code fragment:

//create a query object
GLuint qry;
glGenQueries(1, &qry);

//get current GPU time on the CPU, synchronous call
GLint64 vcpu;
glGetInteger64v(GL_TIMESTAMP, &vcpu);

//push a timestamp query
glQueryCounter(qry, GL_TIMESTAMP);

//fetch the timestamp value immediately
//normally this would be done only later after a fence, but the bug shows this way too
GLuint64 v;
glGetQueryObjectui64v(qry, GL_QUERY_RESULT, &v);

//this fails on Vega, (19.10.1 checked)
assert(v >= vcpu);

 

Note this technique is used to measure pipeline latency and is described also in OpenGL Superbible by Graham Sellers.
The time returned by the glGetInteger64v(GL_TIMESTAMP, ...) call should be lower than the time when the later query has been executed.

Outcomes