Update device query for OpenCL 2.0 queries

Also update test_devquery and fix some related bugs