Ticket #23 (closed feature request: fixed)

Opened 4 years ago

Last modified 23 months ago

Support non-identity elements for scan, fold

Reported by: seanl Owned by:
Priority: minor Milestone:
Component: CUDA backend Version: 0.8.0.0
Keywords: Cc:

Description

It seems that the default value is ignored for Prelude.snd $ Acc.scanl. For example

CUDA.run $ Prelude.snd $ Acc.scanl (+) 5 (Acc.use (fromList 10 [0..]) :: Acc (Vector Word32))

should produce

Array () [50]

however, it produces

Array () [45]

which is

0+ 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
CUDA.run $ Prelude.snd $ Acc.scanl (*) 5 (Acc.use (fromList 10 [1..]) :: Acc (Vector Word32))

should produce

Array () [18144000]

however it produces

Array () [3628800]

which is

1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10

Change History

Changed 4 years ago by seanl

  • summary changed from {{{Prelude.snd $ Acc.scanl}}} does not produce the correct result when the default value is not 0. to Prelude.snd $ Acc.scanl does not produce the correct result when the default value is not 0.

Changed 4 years ago by seanl

  • summary changed from Prelude.snd $ Acc.scanl does not produce the correct result when the default value is not 0. to Prelude.snd $ Acc.scanl ignores the default value and works like an inclusive scan

Changed 4 years ago by tmcdonell

  • status changed from new to assigned

More that it did not include the neutral value in the reduction.

Changed 4 years ago by tmcdonell

I have a patch that addresses this, but the issue is that this is outside the definition of scan in Accelerate. Namely, in the example above 5 is not the neutral element of addition. So, the fact that this works is really an unintended side-effect of the current CUDA implementation, and I do not intend to be tied to it. Indeed, I expect to have completely different implementations for different types.

Changed 4 years ago by tmcdonell

  • status changed from assigned to new
  • summary changed from Prelude.snd $ Acc.scanl ignores the default value and works like an inclusive scan to Support non-identity elements for scan, fold
  • priority changed from major to minor
  • version 0.7.1.0 deleted
  • owner tmcdonell deleted
  • type changed from defect to feature request

Changed 4 years ago by tmcdonell

  • version set to 0.7.1.0

Changed 4 years ago by chak

  • version changed from 0.7.1.0 to 0.8.0.0

Changed 4 years ago by tmcdonell

  • status changed from new to closed
  • resolution set to fixed

Changed 23 months ago by starcomrori1977

Is this really the way it suppose to work? By the what could mean error fatal error access to undeclared static property ?

Note: See TracTickets for help on using tickets.