Skip to content

Low accuracy on Arc A380 #5

@ip2016

Description

@ip2016

It seems like XPU calculation accuracy deteriorates in 4th-5th digit after the dot on common math operation.
Here is the sample code:

a = tf.random.normal(shape=[10000, 10000], dtype=tf.float32) 
b = tf.random.normal(shape=[10000, 10000], dtype=tf.float32)

@tf.function
def run(a, b):
    x1 = tf.nn.relu(a)
    y1 = tf.nn.relu(b)  
    x2 = tf.math.square(x1)
    y2 = tf.math.square(y1)
    x3 = tf.math.scalar_mul(33e-5, x2)
    y3 = tf.math.scalar_mul(33e-5, y2)
    return tf.tensordot(x3, y3, 2)

with tf.device("/XPU:0"):
    print(f"XPU Result: {run(a, b)}")

with tf.device("/CPU:0"):
    print(f"CPU Result: {run(a, b)}")

Which yields the following results:

XPU Result: 2.721888542175293
CPU Result: 2.5815889835357666

System:
Asrock A380
Ubuntu 22.04 (kernel 5.17.0-1019-oem)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions