[Intel-gfx] [PATCH] drm/i915: More reasonable memcpy unroll in i915_gem_swizzle_page

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Dec 20 09:48:18 UTC 2016


On 19/12/2016 10:32, Jani Nikula wrote:
> On Mon, 19 Dec 2016, Joonas Lahtinen <joonas.lahtinen at linux.intel.com> wrote:
>> On ma, 2016-12-19 at 09:19 +0000, Tvrtko Ursulin wrote:
>>> +++ b/drivers/gpu/drm/i915/i915_gem_fence_reg.c
>>> @@ -631,9 +631,9 @@ i915_gem_swizzle_page(struct page *page)
>>>  	vaddr = kmap(page);
>>>
>>>  	for (i = 0; i < PAGE_SIZE; i += 128) {
>>> -		memcpy(temp, &vaddr[i], 64);
>>> +		memcpy(&temp[0], &vaddr[i], 64);
>>>  		memcpy(&vaddr[i], &vaddr[i + 64], 64);
>>> -		memcpy(&vaddr[i + 64], temp, 64);
>>> +		memcpy(&vaddr[i + 64], &temp[0], 64);
>>
>> This reeks of GCC bug badly. So I would not apply as next time the bug
>> could be into the another direction.
>
> Agreed. Please file a bug over at https://gcc.gnu.org/bugs/

Bug filed: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78869

Potentially useful code generation explorer picked up from #gcc: 
https://godbolt.org/g/XNioHs

Regards,

Tvrtko


More information about the Intel-gfx mailing list