All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [Intel-gfx] [PATCH v1 1/1] drm/i915/selftests: Replace too verbose for-loop with simpler while
Date: Wed, 16 Feb 2022 10:55:11 +0200	[thread overview]
Message-ID: <87leyb5gy8.fsf@intel.com> (raw)
In-Reply-To: <Ygv32CptVknidyP3@smile.fi.intel.com>

On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Feb 15, 2022 at 07:14:49PM +0200, Jani Nikula wrote:
>> On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>> > It's hard to parse for-loop which has some magic calculations inside.
>> > Much cleaner to use while-loop directly.
>> 
>> I assume you're trying to prove a point following our recent
>> for-vs-while loop discussion. I really can't think of any other reason
>> you'd end up looking at this file or this loop.
>> 
>> With the change, the loop indeed becomes simpler, but it also runs one
>> iteration further than the original. Whoops.
>
> Yeah, sorry for that, the initial condition should be d = depth - 1,
> of course.

Well, no, the condition should be while (--i) instead to also match the
values the original loop takes. ;D

Cheers,
Jani.


>
>> It's a selftest. The loop's been there for five years. What are we
>> trying to achieve here? So we disagree on loops, fine. Perhaps this is
>> not the best use of either of our time? Please just let the for loops in
>> i915 be.
>
> Yes, I'm pretty much was sure that no-one will go and apply this anyway
> (so I haven't paid too much attention), but to prove my point in the
> certain discussion.
>
> And yes, the point is for the new code, I'm not going to change existing
> suboptimal and too hard to read for-loops, it will consume my time later
> when I will try to understand the code.

-- 
Jani Nikula, Intel Open Source Graphics Center

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v1 1/1] drm/i915/selftests: Replace too verbose for-loop with simpler while
Date: Wed, 16 Feb 2022 10:55:11 +0200	[thread overview]
Message-ID: <87leyb5gy8.fsf@intel.com> (raw)
In-Reply-To: <Ygv32CptVknidyP3@smile.fi.intel.com>

On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Feb 15, 2022 at 07:14:49PM +0200, Jani Nikula wrote:
>> On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>> > It's hard to parse for-loop which has some magic calculations inside.
>> > Much cleaner to use while-loop directly.
>> 
>> I assume you're trying to prove a point following our recent
>> for-vs-while loop discussion. I really can't think of any other reason
>> you'd end up looking at this file or this loop.
>> 
>> With the change, the loop indeed becomes simpler, but it also runs one
>> iteration further than the original. Whoops.
>
> Yeah, sorry for that, the initial condition should be d = depth - 1,
> of course.

Well, no, the condition should be while (--i) instead to also match the
values the original loop takes. ;D

Cheers,
Jani.


>
>> It's a selftest. The loop's been there for five years. What are we
>> trying to achieve here? So we disagree on loops, fine. Perhaps this is
>> not the best use of either of our time? Please just let the for loops in
>> i915 be.
>
> Yes, I'm pretty much was sure that no-one will go and apply this anyway
> (so I haven't paid too much attention), but to prove my point in the
> certain discussion.
>
> And yes, the point is for the new code, I'm not going to change existing
> suboptimal and too hard to read for-loops, it will consume my time later
> when I will try to understand the code.

-- 
Jani Nikula, Intel Open Source Graphics Center

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH v1 1/1] drm/i915/selftests: Replace too verbose for-loop with simpler while
Date: Wed, 16 Feb 2022 10:55:11 +0200	[thread overview]
Message-ID: <87leyb5gy8.fsf@intel.com> (raw)
In-Reply-To: <Ygv32CptVknidyP3@smile.fi.intel.com>

On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Feb 15, 2022 at 07:14:49PM +0200, Jani Nikula wrote:
>> On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>> > It's hard to parse for-loop which has some magic calculations inside.
>> > Much cleaner to use while-loop directly.
>> 
>> I assume you're trying to prove a point following our recent
>> for-vs-while loop discussion. I really can't think of any other reason
>> you'd end up looking at this file or this loop.
>> 
>> With the change, the loop indeed becomes simpler, but it also runs one
>> iteration further than the original. Whoops.
>
> Yeah, sorry for that, the initial condition should be d = depth - 1,
> of course.

Well, no, the condition should be while (--i) instead to also match the
values the original loop takes. ;D

Cheers,
Jani.


>
>> It's a selftest. The loop's been there for five years. What are we
>> trying to achieve here? So we disagree on loops, fine. Perhaps this is
>> not the best use of either of our time? Please just let the for loops in
>> i915 be.
>
> Yes, I'm pretty much was sure that no-one will go and apply this anyway
> (so I haven't paid too much attention), but to prove my point in the
> certain discussion.
>
> And yes, the point is for the new code, I'm not going to change existing
> suboptimal and too hard to read for-loops, it will consume my time later
> when I will try to understand the code.

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-02-16  8:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 16:32 [Intel-gfx] [PATCH v1 1/1] drm/i915/selftests: Replace too verbose for-loop with simpler while Andy Shevchenko
2022-02-15 16:32 ` Andy Shevchenko
2022-02-15 16:32 ` Andy Shevchenko
2022-02-15 17:14 ` [Intel-gfx] " Jani Nikula
2022-02-15 17:14   ` Jani Nikula
2022-02-15 17:14   ` Jani Nikula
2022-02-15 18:58   ` [Intel-gfx] " Andy Shevchenko
2022-02-15 18:58     ` Andy Shevchenko
2022-02-15 18:58     ` Andy Shevchenko
2022-02-16  8:55     ` Jani Nikula [this message]
2022-02-16  8:55       ` Jani Nikula
2022-02-16  8:55       ` Jani Nikula
2022-02-16  9:02       ` [Intel-gfx] " Geert Uytterhoeven
2022-02-16  9:02         ` Geert Uytterhoeven
2022-02-16  9:02         ` Geert Uytterhoeven
2022-02-16 23:28 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v1,1/1] " Patchwork
2022-02-17  7:56 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87leyb5gy8.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.