[Mesa-dev] [PATCH 8/9] llvmpipe: Test more vector lengths.
Jose Fonseca
jfonseca at vmware.com
Tue Apr 19 11:14:49 UTC 2016
On 18/04/16 16:30, Tom Stellard wrote:
> On Mon, Apr 18, 2016 at 10:14:35AM +0100, Jose Fonseca wrote:
>> All power of two of up native vector length.
>>
>> There is actually a bug in lp_build_round for v2, whereby it doesn't
>> round to nearest. Fixing is left to the future, but the test is now
>> able to expect it to fail.
>> ---
>> src/gallium/drivers/llvmpipe/lp_test_arit.c | 43 ++++++++++++++++++++---------
>> 1 file changed, 30 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c
>> index ba831f3..f3ba5a1 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
>> @@ -297,14 +297,16 @@ unary_tests[] = {
>> */
>> static LLVMValueRef
>> build_unary_test_func(struct gallivm_state *gallivm,
>> - const struct unary_test_t *test)
>> + const struct unary_test_t *test,
>> + unsigned length,
>> + const char *test_name)
>> {
>> - struct lp_type type = lp_type_float_vec(32, lp_native_vector_width);
>> + struct lp_type type = lp_type_float_vec(32, length * 32);
>> LLVMContextRef context = gallivm->context;
>> LLVMModuleRef module = gallivm->module;
>> LLVMTypeRef vf32t = lp_build_vec_type(gallivm, type);
>> LLVMTypeRef args[2] = { LLVMPointerType(vf32t, 0), LLVMPointerType(vf32t, 0) };
>> - LLVMValueRef func = LLVMAddFunction(module, test->name,
>> + LLVMValueRef func = LLVMAddFunction(module, test_name,
>> LLVMFunctionType(LLVMVoidTypeInContext(context),
>> args, Elements(args), 0));
>> LLVMValueRef arg0 = LLVMGetParam(func, 0);
>> @@ -371,14 +373,15 @@ flush_denorm_to_zero(float val)
>> * Test one LLVM unary arithmetic builder function.
>> */
>> static boolean
>> -test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test)
>> +test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned length)
>> {
>> + char test_name[128];
>> + util_snprintf(test_name, sizeof test_name, "%s.v%u", test->name, length);
>> struct gallivm_state *gallivm;
>> LLVMValueRef test_func;
>> unary_func_t test_func_jit;
>> boolean success = TRUE;
>> int i, j;
>> - int length = lp_native_vector_width / 32;
>> float *in, *out;
>>
>> in = align_malloc(length * 4, length * 4);
>> @@ -391,7 +394,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test)
>>
>> gallivm = gallivm_create("test_module", LLVMGetGlobalContext());
>
> This is not related to this patch, but the c++ equivalent of
> LLVMGetGlobalContext() has been removed from LLVM, and I think the C
> API may be removed at some point in the future, so these tests should
> be migrated to use LLVMCreateContext().
>
> -Tom
Thanks for the heads up. I went ahead and fixed this in the tests.
There's still a use in llvmpipe, but it's guarded by
PIPE_SUBSYSTEM_EMBEDDED, so it shouldn't affect anybody. We'll deal
with that when LLVM breaks the C ABI -- it's just a matter of creating
the context in llvmpipe_screen
Jose
More information about the mesa-dev
mailing list