Questions tagged [cpu-architecture]
The hardware microarchitecture (x86, x86_64, ARM, ...) of a CPU or microcontroller.
4,072
questions
0
votes
0
answers
20
views
Isn't the Hit rate*Hit time the access time for the cache in L1, L2, Main Hierarchy?
50% hit rate, 2 cycle hit time to L1.
70% hit rate, 15 cycle hit time to L2.
100% hit rate, 200 cycle hit time to main memory.
Calculate the Miss time for L1 cache? (In simultaneous accessing.)
since ...
2
votes
2
answers
56
views
RISC-V architecture, why do one add 4 bytes with no branch but shift with one when branch?
If I understand correctly, when you increment the Program Counter (PC), it needs to be increased by four bytes because all instructions are 32 bits, correct?
What confuses me is that I thought the '...
2
votes
0
answers
32
views
problem occurred while designing an enhancement pipeline datapath for branches (MIPS)
i'm studying MIPS pipeline in Patterson and Hennesy TextBook
this picture below shows the edits for beq instruction :
The idea is to calculate branch target and detect if taken or not in decode stage,...
0
votes
0
answers
16
views
Difference about byte-addressable memory address and memory in direct mapping
Consider a computer uses 48-bit byte-addressable memory address, and it has a memory of 4 GB
and a one-level cache of 2 KB (not counting the space for tags nor dirty flags). Suppose a cache
block is ...
0
votes
0
answers
25
views
how RISCV architecture suggest to fill mtval register in instruction address fault?
If mtval is written with a nonzero value when a breakpoint, address-misaligned, access-fault, or page-fault exception occurs on an instruction fetch, load, or store, then mtval will contain the ...
0
votes
0
answers
39
views
Process/Processor Synchronization without special instructions
My understanding is mutex in multi-core systems basically depend on being able to do an atomic compare + update operation. This consists of simultaneously checking the value of a flag and updating it ...
-4
votes
0
answers
28
views
how to write a assembly program calculate float number by Intel x86(MISP) , I have no book or document to read and study about my problem [closed]
how to write a assembly program calculate float number by Intel x86(MISP) , I have no book or document to read and study about my problem
I only permitted to use basic commmand in J format, I format , ...
0
votes
0
answers
60
views
x86 Performance difference between Shift and Add when packing bits?
Originally I was benchmarking some C code that looked something like:
#include <stdio.h>
#include <inttypes.h>
#include <time.h>
#define NANOSEC_PER_SEC 1000000000LL
static inline ...
1
vote
0
answers
37
views
Adding NOP instructions after branches and jumps for control hazards in a 5-stage RISC pipeline without hazard detection?
There is a RISCV (5 stages pipeline 32-bits) If we supose there is no hazard unit nor forwarding support, so I have to add nop instructions.
If the branch policy is Branch never taken, so we have to ...
0
votes
0
answers
137
views
Relation of Mutex and CPU caches (and memory fences)
Suppose I have an application with multiple threads that need to access some shared data.
I know that a mutex (Critical Section) can be used to ensure that at most one thread at a time can access the ...
2
votes
0
answers
57
views
The overhead-free monitor codes in the AMD CPU significantly increases the total synchronization duration
I am conducting a test to measure the message synchronization latency between different cores of a CPU. Specifically, I am measuring how many clock cycles it takes for CPU2 to detect changes in the ...
0
votes
0
answers
18
views
Where to find Python package CPU architecture compatibility?
Python packages that contain compiled code will sometimes not work on certain CPU architectures (x86, arm64 etc). This problem often pops up when you install Python dependencies on Raspberry Pi, Apple ...
2
votes
0
answers
22
views
L1 Misses in Gem5 not matching L2 Hits+Misses
I am implementing implementing a simple cache hierarchy with 64KB L1 Dcache, 64KB L1 Icache and a unified 4MB L2 cache (all exclusive).
I ran CPU2006 sjeng benchmark and I got the following stats:
...
3
votes
0
answers
82
views
Why is the "mov" with complex addressing faster than the corresponding "lea"? [duplicate]
I looked up in the instruction tables and found that in Coffee Lake, the RThroughput of the lea with 3 components is 1. I think it’s very slow, so I guessed that the RThroughput of the mov with ...
0
votes
0
answers
38
views
Deterministic Finite Automata(DFA) - problem
Basically, I have to construct DFA.
The problem statement:
Construct an automaton that reads binary strings but only accepts (finishes in the final
state) the inputs
{1^i = 11 · · · 1| i times | 3 ...
0
votes
0
answers
52
views
how mips stall happen
Here is the homework question:
We assume that the MIPS code is executed on a pipelined processor with a 5- stage pipeline, full forwarding, and a branch predictor (The “beq” in label1 predicts branch ...
4
votes
1
answer
74
views
Can modern x86 CPUs do ideal out of order execution?
My mental model for out of order execution is to think of it as like a sliding window on the instruction stream, where if there are any instructions in the window that are ready (their inputs have ...
0
votes
0
answers
49
views
Register mutation, is it a CPU hardware issue or a software issue
my android system run monkey,A very strange bug,Register mutation, is it a CPU hardware issue or a software issue?
console log:
-(3)[860:] Unable to handle kernel read from unreadable memory at ...
1
vote
1
answer
57
views
Microcode emulator in Python
I am trying to deal with my computer architecture lab. The task is to create a model of processor in Python. One of the aspects is using microcode to execute machine instruction. As I understand, i ...
1
vote
0
answers
16
views
How to decide minimum pmp region for an architecture?
In RISCV architecture, there are pmp registers that define and control the memory regions. It is stated in the spec "Although the PMP mechanism supports regions as small as four bytes, platforms ...
0
votes
0
answers
19
views
Rotational latency for reads
Reading from disk, assuming always we are in the same track we have two cases:
sequential reads and in different sectors of disk
sequential reads and in same sectors of disk
How would the rotational ...
3
votes
0
answers
122
views
Is there a mask-and-compare instruction for the x86_64 architecture?
Implementations of programming languages that need to preserve type information at runtime often use some bits of an integer value as tagging bits. A typical expression in the C programming language ...
0
votes
0
answers
83
views
Does effective throughput of an instruction depend on the data it operates on?
According to comments the answer is: yes
Alternative (equivalent) question:
Does heat generation (energy) of an instruction depend on data?
Clock speeds of modern chips are often limited by the amount ...
0
votes
0
answers
30
views
How 64bit cpu fetch 8bits(generally 1 Byte) of data from ram
While learning about computer architecture, I came to know about CPUs fetch-execute cycle, ISA, buses and other stuffs. Each CPU can perform on different bit sized data based on their architecture (...
0
votes
0
answers
32
views
Does RISCV SBI refers a hardware implementation or a software standard?
In the RISCV SBI, there are explanations about supervisor and machine communication. As an example, A0-A7 registers are filled with Function and extension ID and also return values for SBI functions. ...
1
vote
1
answer
53
views
Can modern CPUs run in SIMT mode like a GPU?
GPUs use the SIMT (single-instruction, multiple-thread) paradigm where several threads execute the same instructions in perfect unison but applied on different data. This ought to have some advantages ...
0
votes
0
answers
51
views
how best to ensure that pointer has been read into register, for benchmarking purposes?
I have some code roughly like this
unsafe fn foo(p: *const X) {
let x = *p;
let begin = Instant::now();
... // potentially expensive processing of x
let duration = begin.elapsed();
}
The ...
5
votes
1
answer
145
views
Significant speed difference between two seemingly-equivalent methods of calculating prefix sums with GCC for x86-64
I tried two almost identical methods of calculating prefix sums, and found that they have significant differences after being compiled. The compilation option is -O2.
Different compilation results led ...
0
votes
0
answers
17
views
rdtsc delta to nanosecond conversion [duplicate]
Recently, I have been trying to run some performance anlaysis on my program.
I want to measure the latency of some functions in cpu ticks and later convert the delta to nanosecond.
(I intentionally am ...
2
votes
1
answer
62
views
Is there a max size to MIPS static data segment?
This echoes another very similar question about a different memory segment - I figure the answer is the same, but I want to ask to confirm.
For the software convention (not the actual MIPS ...
0
votes
0
answers
34
views
Question is unclear Unit 2.6 : 13.38 questions 3,4,5
https://www.coursera.org/learn/nand2tetris2/discussions/weeks/2/threads/Vgtbr3n0Ee6chgqnqBVDJQ
Suppose that foo has 4 local variables, and assume that we execute the command “call foo 2". What ...
0
votes
1
answer
106
views
How to set thread affinity to either performance or efficient cores?
I am familiar with using pthread_attr_setaffinity_np to set the cpu that a thread would like to run on. In the code below, thread t requests to execute on cpu_target (set to 13), by setting the ...
-1
votes
1
answer
34
views
Is it possible to play video with audio on a single processor computer which can run only one process at a time
From what I know about processors and it's working, one processor can run one process at a time.
So for a task like playing video which have more than one component like playing video and audio that ...
0
votes
0
answers
35
views
Creating Cache Conflict in assembly
Cache Size: 4 KB By Default
Line Size : 32 Bytes
Address Bits division:
Number of sets: Cache Size/ 2x line size (multiplying by two as we have two way set associative cache) = 4096/2x32 = 64 Sets
1- ...
-1
votes
1
answer
80
views
What would prevent converting RISC-V instructions to Intel micro-ops? [closed]
Intel is known to have been working on hardware to support the RISC-V ISA.
What however specifically would prevent them from adding a second decoder to an x86 CPU that can decode RISC-V instructions ...
0
votes
0
answers
132
views
Contention for stores to a shared cache line from all cores on multiple sockets (Xeon Scalable) is causing system to become sluggish
#include <glibmm/thread.h>
#include <sys/sysinfo.h>
#include <stdio.h>
void threadLoop(int *PtrCounter)
{
struct timespec sleep = {0};
while (1)
{
*PtrCounter +...
0
votes
1
answer
70
views
Skipping store queue searches in Gem5 when issuing loads causes crashes in guest
I'm modifying Gem5 (version 22.0.0.1) for a research project and one thing I'm testing is using special loads which when issued do not search the store queue for a potential store forward.
I've ...
0
votes
0
answers
20
views
Will page table data be saved in the CPU cache? [duplicate]
The page table will be saved in memory and accessed during the page walk process after TLB miss. Will this portion of memory be treated as ordinary data and enter the traditional L1-D/L2/L3 cache?
If ...
1
vote
1
answer
139
views
Will an x86_64 CPU notice that a page-table entry has changed to not-present while setting the dirty flag in the PTE?
There is a scenario as follows:
The pte a of PAGE A set following field:
BIT(0) present
BIT(1) writable
BIT(M-1,12) page frame
dirty flag is NOT SET
CPU0 CPU1
...
0
votes
0
answers
47
views
Preventing direct encoding from taking up the full encoding space for custom cpu architecture
I am currently creating a CPU architecture as a hobby, and am writing an assembler in Python. I've chosen to directly encode the instruction, registers, and immediate values because it's easier at the ...
0
votes
0
answers
19
views
Is L2 TLBs on the critical path for L1 cache accesses?
Considering only dcache and dTLB. Due to the current L1d-cache being VIPT, it is necessary to obtain a physical address before cache hit.
Now, it is sure that the hit judgment of L1d-cache depends on ...
0
votes
0
answers
43
views
How can I determine if my Intel CPU supports disabling prefetching through model specific registers?
I will be helping with a hardware security class in the spring, and I am currently setting up some of the labs for the class. One of the labs we are doing is a cache side-channels lab where we look at ...
0
votes
0
answers
20
views
what's the relationship about memory controller && channel && DIMMs?
I'm reading Computer Architecture, A Quantitative Approach'. And what's the relationship about memory controller && channel && DIMMs?
If the instruction is not found in the L3 cache, ...
0
votes
0
answers
35
views
How to accurately check the execution time of a code segment
I'm debugging a high performance data path on x86-64 platform. Its execution time may jitter, but its code is very short(might be 20-100 cpu cycles), how to accurately get its execution time?
Thank ...
0
votes
0
answers
50
views
Is perf sampling reliable in arm Linux?
I wrote a demo to test the reliability of perf and there is a strange thing which I can't explain, my demo code:
int main(){
while(1){
asm("nop");
asm("nop");
...
0
votes
0
answers
18
views
Is a Feedback Loop from Program Counter output to input problematic?
Im designing a very simple CPU to be built on a custom PCB. I designed the CPU in LogicCircuit, and it seems to work. But I'm wondering it a specific part of the CPU will also work in real life.
I ...
4
votes
0
answers
112
views
Why using non-temporal store instructions cannot reduce memory bandwidth usage? (Writes seem to be generating extra reads)
I want to use the non-temporary instruction to reduce the read bandwidth generated by write allocate during the memcpy process. The expected read and write bandwidth after optimization should be the ...
0
votes
1
answer
120
views
Is x86_64 IDT shared between CPUs in Linux kernel?
TLDR:
Q1: Does Intel x86_64 architecture has per CPU idtr? If so, then should IDT be loaded N times, where N is the number of CPUs? I mean for each CPU, not for one CPU N times.
Q2: I found that IDT ...
0
votes
0
answers
67
views
What are the advantages of write-combine memory compared to write-back memory?
In Software Optimization Guide for the AMD Zen4 Microarchitecture, it is written that:
Write-combining is the merging of multiple memory write cycles that target locations within the address range of ...
0
votes
1
answer
41
views
How to match the microarchitectural values produced in the pipeline with its corresponding architectural instruction?
My goal is to match all pipeline values (all the signals at the microarchitectural states in the processor) produced by the execution of the corresonding instruction for a scalar, in-oder RISCV ...